diff options
author | Sven Gothel <[email protected]> | 2011-12-11 04:47:27 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-11 04:47:27 +0100 |
commit | 9291731fec7103301ba36511ceb4375f63170e5c (patch) | |
tree | ec7f0d9c9ce611833840971206d2c591a94653b4 /src/newt | |
parent | d9bbbbad1130bbe74856ecedb7cf1d2cc124b352 (diff) |
Fix concurrency bug of GLProfile initialization ; Fix SharedResourceRunner 'dead' thread (Applets)
GLDrawableFactory:
- clarify: public getWasSharedContextCreated(..) -> protected createSharedResource(..)
- add: getSharesResourceThread()
GLProfile:
- proper locking of initSingletion(..) path:
- Use RecursiveThreadGroupLock and add/remove GLDrawableFactory's sharesResourceThread
while creating it's the sharedResource.
This simplifies and fixes GLProfile's locking code.
- Fix and simplify initSingleton(boolean) API doc - mark it deprecated.
- Add initSingleton() for controlled initialization only, pairing w/ shutdown(..)
Remove initSingleton(boolean) calls in code and test!
+++
Fix SharedResourceRunner 'dead' thread (Applets)
In Applets, stopping an Applet makes the browser Java plugin interrupting
and killing all related threads, including our SharedResourceRunner thread.
- Validate whether the shared resource thread is alive
- Catch interruption in shared resource thread and assume it's a kill signal
- releaseSharedResource: clear devicesTried set
Diffstat (limited to 'src/newt')
3 files changed, 2 insertions, 7 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index ebcc0dd27..105f8369a 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -170,7 +170,6 @@ public class JOGLNewtApplet1Run extends Applet { glTrace); try { - GLProfile.initSingleton(false); GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); caps.setAlphaBits(glAlphaBits); if(0<glNumMultisampleBuffer) { @@ -271,7 +270,6 @@ public class JOGLNewtApplet1Run extends Applet { } base.destroy(); // destroy glWindow unrecoverable base=null; - GLProfile.shutdown(GLProfile.ShutdownType.SHARED_ONLY); if(DEBUG) { System.err.println("JOGLNewtApplet1Run.destroy() END"); } diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java index 6b135976b..67da50210 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -43,6 +43,7 @@ import jogamp.newt.Debug; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; @@ -199,6 +200,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { public void start() { if(isValid) { glWindow.setVisible(true); + glWindow.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); glAnimator.start(); awtParent = glWindow.getParent(); } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index a7326d916..f7c05cd45 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -27,8 +27,6 @@ */ package jogamp.newt.driver.android; -import javax.media.opengl.GLProfile; - import com.jogamp.newt.Window; import com.jogamp.opengl.util.Animator; @@ -100,9 +98,6 @@ public class NewtBaseActivity extends Activity { jogamp.common.os.android.StaticContext.setContext(extActivity.getApplicationContext()); } extActivity.getWindow(); - - // init GLProfile - GLProfile.initSingleton(true); } @Override |