summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-12-02 04:09:41 +0100
committerSven Gothel <[email protected]>2012-12-02 04:09:41 +0100
commitaa4b8c9abbf9529fdbb3c4982895c01f2698451f (patch)
tree778ee08153a6c75ac8bc28b252ca308f8d056989 /src/newt/classes/com/jogamp
parentf0f58e120817b57ed3fb70c238001579a68e4064 (diff)
NEWT EDTUtil: Simplify running state (default is running @ setEDTUtil()); Simplify DefaultEDTUtil impl. and fix concurrency leak w/ 'shouldStop'
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/Display.java12
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java5
-rw-r--r--src/newt/classes/com/jogamp/newt/util/EDTUtil.java3
3 files changed, 10 insertions, 10 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java
index 4c263a195..993aa33eb 100644
--- a/src/newt/classes/com/jogamp/newt/Display.java
+++ b/src/newt/classes/com/jogamp/newt/Display.java
@@ -158,19 +158,15 @@ public abstract class Display {
* </p>
* <p>
* If a previous one exists and it differs from the new one,
- * it's being stopped, wait-until-idle and reset to allow restart.
+ * it's being stopped, wait-until-idle and reset to allow a restart at a later time.
* </p>
* <p>
* If <code>newEDTUtil</code> is not null and equals the previous one,
- * <code>null</code> is returned and no change is being made.
+ * no change is being made.
* </p>
* <p>
- * Note that <code>newEDTUtil</code> will not be started by this method.
- * To do so you may issue {@link EDTUtil#invoke(boolean, Runnable) invoke}
- * on the new EDTUtil:
- * <pre>
- * newEDTUtil.invoke(true, null);
- * </pre>
+ * Note that <code>newEDTUtil</code> will be started by this method,
+ * if it is not running yet.
* </p>
*/
public abstract EDTUtil setEDTUtil(EDTUtil newEDTUtil);
diff --git a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
index 2203d744a..1c20fe524 100644
--- a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java
@@ -150,7 +150,10 @@ public class SWTEDTUtil implements EDTUtil {
// System.err.println(Thread.currentThread()+" XXX stop: "+stop+", tasks: "+edt.tasks.size()+", task: "+task);
// Thread.dumpStack();
if(stop) {
- nedt.shouldStop = true;
+ synchronized(nedt.sync) {
+ nedt.shouldStop = true;
+ nedt.sync.notifyAll(); // stop immediate if waiting (poll freq)
+ }
if(DEBUG) {
System.err.println(Thread.currentThread()+": SWT-EDT signal STOP (on edt: "+isCurrentThreadEDT()+") - "+nedt);
// Thread.dumpStack();
diff --git a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
index 293e13592..0183da592 100644
--- a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
@@ -113,7 +113,8 @@ public interface EDTUtil {
/**
* Append the final task to the EDT task queue,
- * signals EDT to stop and wait until stopped.<br>
+ * signals EDT to stop and wait until stopped.<br/>
+ * <code>task</code> maybe <code>null</code><br/>
* Due to the nature of this method:
* <ul>
* <li>All previous queued tasks will be finished.</li>