summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-11-25 14:58:05 +0100
committerSven Gothel <[email protected]>2012-11-25 14:58:05 +0100
commitb6fa407d4bf19ef9fe387454b5eeca68853532b9 (patch)
tree21a38eb9244329c13a1e9f16952c28182188296e /src/newt/classes/com/jogamp
parentcc5fb8d9f807089c5d119f3b56eed7d018a1dba2 (diff)
SWTEDTUtil/AWTEDTUtil: Fix deadlock situation in waitUntilStopped(), etc - wrap task execution (or enqueing) into status-sync 'edtLock'
This fixes the disparity w/ DefaultEDTUtil, i.e. aligns it's implementation/semantics.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
index d40aa18cf..d08fefa29 100644
--- a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
@@ -154,17 +154,23 @@ public class SWTEDTUtil implements EDTUtil {
// Thread.dumpStack();
}
}
-
- // start if should not stop && not started yet
- if( !stop && !nedt.isRunning() ) {
- startImpl();
+ if( isCurrentThreadEDT() ) {
+ task.run();
+ wait = false; // running in same thread (EDT) -> no wait
+ } else if( swtDisplay.isDisposed() ) {
+ wait = false; // drop task, SWT disposed
+ } else {
+ // start if should not stop && not started yet
+ if( !stop && !nedt.isRunning() ) {
+ startImpl();
+ }
+ if(wait) {
+ swtDisplay.syncExec(task);
+ } else {
+ swtDisplay.asyncExec(task);
+ }
}
}
- if(wait) {
- swtDisplay.syncExec(task);
- } else {
- swtDisplay.asyncExec(task);
- }
}
@Override