aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java b/src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java
index ea1e63b8b..a2a6939cd 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLRunnableTask.java
@@ -38,27 +38,52 @@ import javax.media.opengl.GLAutoDrawable;
public class GLRunnableTask implements GLRunnable {
GLRunnable runnable;
Object notifyObject;
+ boolean catchExceptions;
+ boolean isExecuted;
Throwable runnableException;
- public GLRunnableTask(GLRunnable runnable, Object notifyObject) {
+ public GLRunnableTask(GLRunnable runnable, Object notifyObject, boolean catchExceptions) {
this.runnable = runnable ;
this.notifyObject = notifyObject ;
+ this.catchExceptions = catchExceptions;
+ isExecuted = false;
}
public void run(GLAutoDrawable drawable) {
- try {
- runnable.run(drawable);
- } catch (Throwable t) {
- runnableException = t;
- }
- if(null != notifyObject) {
+ if(null == notifyObject) {
+ try {
+ runnable.run(drawable);
+ } catch (Throwable t) {
+ runnableException = t;
+ if(catchExceptions) {
+ runnableException.printStackTrace();
+ } else {
+ throw new RuntimeException(runnableException);
+ }
+ } finally {
+ isExecuted=true;
+ }
+ } else {
synchronized (notifyObject) {
- notifyObject.notifyAll();
+ try {
+ runnable.run(drawable);
+ } catch (Throwable t) {
+ runnableException = t;
+ if(catchExceptions) {
+ runnableException.printStackTrace();
+ } else {
+ throw new RuntimeException(runnableException);
+ }
+ } finally {
+ isExecuted=true;
+ notifyObject.notifyAll();
+ }
}
}
}
+ public boolean isExecuted() { return isExecuted; }
public Throwable getThrowable() { return runnableException; }
}