From cc64ad2b1f7904af4e7bd27e927e0bb331db782b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 25 Jun 2013 07:04:17 +0200 Subject: NEWT WindowImpl/GLWindow: @ JVM Shutdown, force stop animation thread w/o blocking. --- src/newt/classes/jogamp/newt/WindowImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/newt/classes/jogamp') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 6787f0ab3..77ff21061 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -88,7 +88,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer ScreenImpl.initSingleton(); } - /** Maybe utilized at a shutdown hook, impl. does not synchronize, however the Window destruction and EDT removal blocks. */ + /** Maybe utilized at a shutdown hook, impl. does not block. */ public static final void shutdownAll() { final int wCount = windowList.size(); if(DEBUG_IMPLEMENTATION) { @@ -99,7 +99,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.shutdownAll["+(i+1)+"/"+wCount+"]: "+toHexString(w.getWindowHandle())); } - w.markInvalid(); + w.shutdown(); } } @@ -242,7 +242,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Fast invalidation of instance w/o any blocking function call. */ - private final void markInvalid() { + private final void shutdown() { + if(null!=lifecycleHook) { + lifecycleHook.shutdownRenderingAction(); + } setWindowHandle(0); visible = false; fullscreen = false; @@ -310,6 +313,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @see #pauseRenderingAction() */ void resumeRenderingAction(); + + /** + * Shutdown rendering action (thread) abnormally. + *

+ * Should be called only at shutdown, if necessary. + *

+ */ + void shutdownRenderingAction(); } private boolean createNative() { -- cgit v1.2.3