diff options
Diffstat (limited to 'src/com/jogamp/opencl/util/CLMultiContext.java')
-rw-r--r-- | src/com/jogamp/opencl/util/CLMultiContext.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java index eb42092e..156a9fa6 100644 --- a/src/com/jogamp/opencl/util/CLMultiContext.java +++ b/src/com/jogamp/opencl/util/CLMultiContext.java @@ -25,6 +25,7 @@ import static com.jogamp.opencl.CLDevice.Type.*; public class CLMultiContext implements CLResource { private final List<CLContext> contexts; + private boolean released; private CLMultiContext() { contexts = new ArrayList<CLContext>(); @@ -132,7 +133,12 @@ public class CLMultiContext implements CLResource { * Releases all contexts. * @see CLContext#release() */ + @Override public void release() { + if(released) { + throw new RuntimeException(getClass().getSimpleName()+" already released"); + } + released = true; for (CLContext context : contexts) { context.release(); } @@ -154,6 +160,10 @@ public class CLMultiContext implements CLResource { return devices; } + public boolean isReleased() { + return released; + } + @Override public String toString() { return getClass().getSimpleName()+" [" + contexts.size()+" contexts, " |