summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-25 10:40:17 +0200
committerSven Gothel <[email protected]>2013-06-25 10:40:17 +0200
commit80902692c3e9615cf0b9ea042ce5fdd38b98aa49 (patch)
tree59b4735388ff5497988b4b64ea11c34cb37f956a /src/com
parentd4aef175f1dadae9d12c9930a873b5f3862ac953 (diff)
CLContext.release: Avoid 'concurrency map modify exception'
Diffstat (limited to 'src/com')
-rw-r--r--src/com/jogamp/opencl/CLContext.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index e3b83ae7..c3bd0e3f 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -52,6 +52,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -506,11 +507,14 @@ public class CLContext extends CLObjectResource {
release(memoryObjects);
release(samplers);
- for (List<CLCommandQueue> queues : queuesMap.values()) {
- release(queues);
+ synchronized(queuesMap) {
+ final Collection<List<CLCommandQueue>> queuesList = queuesMap.values();
+ for( Iterator<List<CLCommandQueue>> queuesI = queuesList.iterator(); queuesI.hasNext(); ) {
+ release(queuesI.next());
+ }
}
- }finally{
+ } finally {
int ret = platform.getContextBinding().clReleaseContext(ID);
checkForError(ret, "error releasing context");
}