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
33
package
com.jogamp.opencl;
34
35
import
static
com.jogamp.opencl.CLException.*;
36
import
static
com.jogamp.opencl.llb.CL.*;
37
import
com.jogamp.opencl.llb.CL;
38
39
/**
40
* Custom, user controlled event.
41
* @see CLEvent
42
* @author Michael Bien
43
*/
44
public
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
*/
65
public
CLUserEvent
setStatus
(
final
CLEvent
.
ExecutionStatus
status) {
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
*/
78
public
CLUserEvent
setComplete
() {
79
return
setStatus
(
ExecutionStatus
.
COMPLETE
);
80
}
81
82
/**
83
* Returns {@link CLEvent.CommandType#USER}.
84
*/
85
@Override
86
public
CommandType
getType
() {
87
return
CommandType
.
USER
;
88
}
89
90
}
com.jogamp.opencl.CLContext
CLContext is responsible for managing objects such as command-queues, memory, program and kernel obje...
Definition:
CLContext.java:79
com.jogamp.opencl.CLContext.getPlatform
CLPlatform getPlatform()
Returns the CLPlatform this context is running on.
Definition:
CLContext.java:569
com.jogamp.opencl.CLEvent
Event objects can be used for synchronizing command queues, e.g you can wait until a event occurs or ...
Definition:
CLEvent.java:48
com.jogamp.opencl.CLObject.context
CLContext context
Definition:
CLObject.java:43
com.jogamp.opencl.CLObject.ID
final long ID
The OpenCL object handle.
Definition:
CLObject.java:41
com.jogamp.opencl.CLObject.getPlatform
CLPlatform getPlatform()
Returns the platform for this OpenCL object.
Definition:
CLObject.java:65
com.jogamp.opencl.CLPlatform.getCLBinding
CL getCLBinding()
Definition:
CLPlatform.java:543
com.jogamp.opencl.CLUserEvent
Custom, user controlled event.
Definition:
CLUserEvent.java:44
com.jogamp.opencl.CLUserEvent.setComplete
CLUserEvent setComplete()
Sets this event's status to CLEvent.ExecutionStatus#COMPLETE.
Definition:
CLUserEvent.java:78
com.jogamp.opencl.CLUserEvent.create
static CLUserEvent create(final CLContext context)
Creates a new user event.
Definition:
CLUserEvent.java:53
com.jogamp.opencl.CLUserEvent.setStatus
CLUserEvent setStatus(final CLEvent.ExecutionStatus status)
Sets the event execution status.
Definition:
CLUserEvent.java:65
com.jogamp.opencl.CLUserEvent.getType
CommandType getType()
Returns CLEvent.CommandType#USER.
Definition:
CLUserEvent.java:86
com.jogamp.opencl.CLEvent.CommandType
Definition:
CLEvent.java:277
com.jogamp.opencl.CLEvent.CommandType.USER
USER
Definition:
CLEvent.java:297
com.jogamp.opencl.CLEvent.ExecutionStatus
Definition:
CLEvent.java:221
com.jogamp.opencl.CLEvent.ExecutionStatus.COMPLETE
COMPLETE
The command has completed.
Definition:
CLEvent.java:242
com.jogamp.opencl.llb.CL
Java bindings to OpenCL, the Open Computing Language.
Definition:
CL.java:26
com.jogamp.opencl.llb.CL.clSetUserEventStatus
int clSetUserEventStatus(long event, int execution_status)
Interface to C language function: cl_int {@native clSetUserEventStatus}(cl_event event,...
com.jogamp.opencl.llb.CL.clCreateUserEvent
long clCreateUserEvent(long context, IntBuffer errcode_ret)
Interface to C language function: cl_event {@native clCreateUserEvent}(cl_context context,...
src
com
jogamp
opencl
CLUserEvent.java
Generated by
1.9.4