JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java™ (public API).
CLUserEvent.java
Go to the documentation of this file.
1/*
2 * Copyright 2009 - 2010 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29/*
30 * Created on Wednesday, June 16 2010 18:05
31 */
32
33package com.jogamp.opencl;
34
35import static com.jogamp.opencl.CLException.*;
36import static com.jogamp.opencl.llb.CL.*;
37import com.jogamp.opencl.llb.CL;
38
39/**
40 * Custom, user controlled event.
41 * @see CLEvent
42 * @author Michael Bien
43 */
44public class CLUserEvent extends CLEvent {
45
46 CLUserEvent(final CLContext context, final long ID) {
47 super(context, ID);
48 }
49
50 /**
51 * Creates a new user event.
52 */
53 public static CLUserEvent create(final CLContext context) {
54 final CL binding = context.getPlatform().getCLBinding();
55 final int[] error = new int[1];
56 final long ID = binding.clCreateUserEvent(context.ID, error, 0);
57 checkForError(error[0], "can not create user event.");
58 return new CLUserEvent(context, ID);
59 }
60
61 /**
62 * Sets the event execution status.
63 * Calls {@native clSetUserEventStatus}.
64 */
66 final CL binding = getPlatform().getCLBinding();
67 final int err = binding.clSetUserEventStatus(ID, status.STATUS);
68 if(err != CL_SUCCESS) {
69 newException(err, "can not set status "+status);
70 }
71 return this;
72 }
73
74 /**
75 * Sets this event's status to {@link CLEvent.ExecutionStatus#COMPLETE}.
76 * @see #setStatus(com.jogamp.opencl.CLEvent.ExecutionStatus)
77 */
80 }
81
82 /**
83 * Returns {@link CLEvent.CommandType#USER}.
84 */
85 @Override
87 return CommandType.USER;
88 }
89
90}
CLContext is responsible for managing objects such as command-queues, memory, program and kernel obje...
Definition: CLContext.java:79
CLPlatform getPlatform()
Returns the CLPlatform this context is running on.
Definition: CLContext.java:569
Event objects can be used for synchronizing command queues, e.g you can wait until a event occurs or ...
Definition: CLEvent.java:48
final long ID
The OpenCL object handle.
Definition: CLObject.java:41
CLPlatform getPlatform()
Returns the platform for this OpenCL object.
Definition: CLObject.java:65
Custom, user controlled event.
CLUserEvent setComplete()
Sets this event's status to CLEvent.ExecutionStatus#COMPLETE.
static CLUserEvent create(final CLContext context)
Creates a new user event.
CLUserEvent setStatus(final CLEvent.ExecutionStatus status)
Sets the event execution status.
CommandType getType()
Returns CLEvent.CommandType#USER.
COMPLETE
The command has completed.
Definition: CLEvent.java:242
Java bindings to OpenCL, the Open Computing Language.
Definition: CL.java:26
int clSetUserEventStatus(long event, int execution_status)
Interface to C language function: cl_int {@native clSetUserEventStatus}(cl_event event,...
long clCreateUserEvent(long context, IntBuffer errcode_ret)
Interface to C language function: cl_event {@native clCreateUserEvent}(cl_context context,...