diff options
author | Sven Gothel <[email protected]> | 2010-11-25 03:02:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-25 03:02:26 +0100 |
commit | 20dd60820257af9aef8ff3eeab1c03736252e284 (patch) | |
tree | ad0cdd1e234ceb3dc7a8800d315326de5b9fcdb7 /src/jogl/classes/com/jogamp/opengl/util/Animator.java | |
parent | c62a07ceeafec94c4327b8db2d2dc359043b2f2b (diff) |
Relax GLAnimatorControl, ie remove fail fast for start()/stop(), return (boolean)success instead.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/Animator.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/Animator.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 31abe099d..311b4141f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -253,9 +253,9 @@ public class Animator extends AnimatorBase { } } - public synchronized void start() { + public synchronized boolean start() { if ( isStartedImpl() ) { - throw new GLException("Start: Already running (started "+isStartedImpl()+" (false))"); + return false; } if (runnable == null) { runnable = new MainLoop(); @@ -271,7 +271,9 @@ public class Animator extends AnimatorBase { thread.setDaemon(true); // don't stop JVM from shutdown .. thread.start(); finishLifecycleAction(waitForStartedCondition); + return true; } + private class WaitForStartedCondition implements Condition { public boolean result() { return !isStartedImpl() || (!drawablesEmpty && !isAnimating) ; @@ -279,13 +281,14 @@ public class Animator extends AnimatorBase { } Condition waitForStartedCondition = new WaitForStartedCondition(); - public synchronized void stop() { + public synchronized boolean stop() { if ( !isStartedImpl() ) { - throw new GLException("Stop: Not running (started "+isStartedImpl()+" (true))"); + return false; } stopIssued = true; notifyAll(); finishLifecycleAction(waitForStoppedCondition); + return true; } private class WaitForStoppedCondition implements Condition { public boolean result() { |