From 826dacffbae941a35a7cc74515751ddb1d5711a2 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 19 Jun 2011 22:31:05 +0200 Subject: - added isReleased() to CLResource, made CLObject public. - a CLResource will throw an Exception if released twice. --- src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java') 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 implements CLResource private List contexts; private ExecutorService excecutor; private FinishAction finishAction = FinishAction.DO_NOTHING; + private boolean released; private CLCommandQueuePool(CLQueueContextFactory factory, Collection queues) { this.contexts = initContexts(queues, factory); @@ -157,7 +158,12 @@ public class CLCommandQueuePool 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 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}. -- cgit v1.2.3