diff options
Diffstat (limited to 'src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java')
-rw-r--r-- | src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java index 9ea960ae..e8bd0124 100644 --- a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java +++ b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java @@ -29,6 +29,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource private List<CLQueueContext> contexts; private ExecutorService excecutor; private FinishAction finishAction = FinishAction.DO_NOTHING; + private boolean released; private CLCommandQueuePool(CLQueueContextFactory factory, Collection<CLCommandQueue> queues) { this.contexts = initContexts(queues, factory); @@ -157,7 +158,12 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource /** * Releases all queues. */ + @Override public void release() { + if(released) { + throw new RuntimeException(getClass().getSimpleName()+" already released"); + } + released = true; excecutor.shutdown(); for (CLQueueContext context : contexts) { context.queue.finish().release(); @@ -187,6 +193,11 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource return finishAction; } + @Override + public boolean isReleased() { + return released; + } + /** * Sets the action which is run after every completed task. * This is mainly intended for debugging, default value is {@link FinishAction#DO_NOTHING}. |