From 3ed491213f8f7f05d7b9866b50d764370d8ff5f6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 25 Mar 2012 03:29:53 +0200 Subject: 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! --- src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/jogamp/opengl/GLWorkerThread.java') 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) { -- cgit v1.2.3