blob: 56fb7a0c349668dfed55bd9ae610669f65b3ebdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* Created on Wednesday, June 16 2010 18:05
*/
package com.jogamp.opencl;
import static com.jogamp.opencl.CLException.*;
import static com.jogamp.opencl.CL.*;
/**
* Custom, user controlled event.
* @see CLEvent
* @author Michael Bien
*/
public class CLUserEvent extends CLEvent {
CLUserEvent(CLContext context, long ID) {
super(context, ID);
}
/**
* Creates a new user event.
*/
public static CLUserEvent create(CLContext context) {
int[] error = new int[1];
long ID = context.cl.clCreateUserEvent(context.ID, error, 0);
checkForError(error[0], "can not create user event.");
return new CLUserEvent(context, ID);
}
/**
* Sets the event execution status.
* Calls {@native clSetUserEventStatus}.
*/
public CLUserEvent setStatus(CLEvent.ExecutionStatus status) {
int err = cl.clSetUserEventStatus(ID, status.STATUS);
if(err != CL_SUCCESS) {
newException(err, "can not set status "+status);
}
return this;
}
/**
* Sets this event's status to {@link CLEvent.ExecutionStatus#COMPLETE}.
* @see #setStatus(com.jogamp.opencl.CLEvent.ExecutionStatus)
*/
public CLUserEvent setComplete() {
return setStatus(ExecutionStatus.COMPLETE);
}
/**
* Returns {@link CLEvent.CommandType#USER}.
*/
@Override
public CommandType getType() {
return CommandType.USER;
}
}
|