diff options
author | Sven Gothel <[email protected]> | 2012-03-25 03:29:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-25 03:29:53 +0200 |
commit | 3ed491213f8f7f05d7b9866b50d764370d8ff5f6 (patch) | |
tree | 07ea2547be486eb50db9d79a19f6e0c4dfa4dc70 /src/jogl/classes/jogamp/opengl/GLWorkerThread.java | |
parent | 45a42f7c7f7fce4e6c7eb495591c438bdf0170a2 (diff) |
Enhance and generalize AWT Threading* implementation; Minor changes ..
Threading*:
- add invoke(..) generalizing the Therading decision
GLCanvas:
- remove 'manual' Threading decision, simply call Threading.invoke(..)
- use anonymous Runnable instances
- remove drawable lock, drawable is volatile instead
GLJPanel:
- remove 'manual' Threading decision, simply call Threading.invoke(..)
- use anonymous Runnable instances
- DEBUG: Use getThreadName() prefix
GLContextImpl:
- Remove GLWorkerThread idle command on makeCurrent(),
no holding of context in worker thread while idle.
- DEBUG: Use getThreadName() prefix
X11GLXContext:
- DEBUG: Use getThreadName() prefix
TODO: Validate whether it's OK for GLCanvas and GLJPanel to set Threading.Mode.MT as the default mode!
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLWorkerThread.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index e717ec64c..f7d59e127 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -79,7 +79,7 @@ public class GLWorkerThread { if (!started) { lock = new Object(); thread = new Thread(new WorkerRunnable(), - "JOGL GLWorkerThread"); + "JOGL-GLWorkerThread-"); thread.setDaemon(true); started = true; synchronized (lock) { @@ -149,6 +149,15 @@ public class GLWorkerThread { } } + public static void invoke(boolean wait, Runnable runnable) + throws InvocationTargetException, InterruptedException { + if(wait) { + invokeAndWait(runnable); + } else { + invokeLater(runnable); + } + } + public static void invokeAndWait(Runnable runnable) throws InvocationTargetException, InterruptedException { if (!started) { |