summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLEventList.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/CLEventList.java')
-rw-r--r--src/com/jogamp/opencl/CLEventList.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java
index 8c09f60f..53d59d41 100644
--- a/src/com/jogamp/opencl/CLEventList.java
+++ b/src/com/jogamp/opencl/CLEventList.java
@@ -98,6 +98,41 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
events[size] = new CLEvent(context, IDs.get());
size++;
}
+
+ NativeSizeBuffer getEventBuffer(int index) {
+ return NativeSizeBuffer.wrap(IDs.getBuffer().duplicate()).position(index);
+ }
+
+ /**
+ * Waits for all events in this list to occur.
+ * If this list is empty this method won't do anything.
+ */
+ public void waitForEvents() {
+ if(size > 0) {
+ events[0].getPlatform().getEventBinding().clWaitForEvents(size, IDsView);
+ }
+ }
+
+ /**
+ * Waits for all events of the specified region in this list to occur.
+ * Will throw IndexOutOfBoundsException if indices are out of bounds.
+ */
+ public void waitForEvents(int start, int range) {
+ if(start+range < size || range <= 0) {
+ throw new IndexOutOfBoundsException("args: [start: "+start+" range: "+range+"], eventcount: "+size);
+ }
+
+ NativeSizeBuffer view = getEventBuffer(start);
+ getEvent(start).getPlatform().getEventBinding().clWaitForEvents(range, view);
+ }
+
+ /**
+ * Waits for the event with the given index in this list to occur.
+ */
+ public void waitForEvent(int index) {
+ NativeSizeBuffer view = getEventBuffer(index);
+ getEvent(index).getPlatform().getEventBinding().clWaitForEvents(1, view);
+ }
/**
* Releases all CLEvents in this list.