diff options
author | Michael Bien <[email protected]> | 2010-09-02 22:50:00 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-09-02 22:50:00 +0200 |
commit | 0e3893e7e3e270f8231b89eaf89537cf01a43052 (patch) | |
tree | afec21aeb7809abad9efd5fa326dcfd8fdbbd77e /src/com/jogamp/opencl/CLEvent.java | |
parent | 2388b47f180989abd14a39188b1d4f80f221bdcf (diff) |
CLEvent callbacks for HLB and LLB.
Diffstat (limited to 'src/com/jogamp/opencl/CLEvent.java')
-rw-r--r-- | src/com/jogamp/opencl/CLEvent.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index b7df1465..8423e7c6 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -1,7 +1,10 @@ package com.jogamp.opencl; +import com.jogamp.opencl.impl.CLEventCallback; +import java.util.List; import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; +import java.util.ArrayList; import static com.jogamp.opencl.CL.*; import static com.jogamp.opencl.CLException.*; @@ -25,6 +28,22 @@ public class CLEvent extends CLObject implements CLResource { this.eventProfilingInfo = new CLEventProfilingInfoAccessor(); } + /** + * Registers a callback which will be called when the event terminates (COMPLETE or ERROR). + */ + public void registerCallback(final CLEventListener callback) { + this.registerCallback(callback, ExecutionStatus.COMPLETE); + } + + // apparently only ExecutionStatus.COMPLETE is allowed -> private + private void registerCallback(final CLEventListener callback, ExecutionStatus trigger) { + cl.clSetEventCallback(ID, trigger.STATUS, new CLEventCallback() { + public void eventStateChanged(long event, int status) { + callback.eventStateChanged(CLEvent.this, status); + } + }); + } + public void release() { int ret = cl.clReleaseEvent(ID); checkForError(ret, "can not release event"); |