diff options
Diffstat (limited to 'src/nativewindow/classes/jogamp')
7 files changed, 17 insertions, 26 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java index 0c2a1e43f..c9f830811 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java @@ -36,16 +36,19 @@ import com.jogamp.common.util.locks.RecursiveLock; /** * Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}. * <p> - * This is the last resort for unstable driver, e.g. proprietary ATI/X11 12.8 and 12.9, - * where multiple X11 display connections to the same connection name are not treated - * thread safe within the GL/X11 driver. + * This is the last resort for unstable driver where multiple X11 display connections + * to the same connection name are not treated thread safe within the GL/X11 driver. * </p> */ public class GlobalToolkitLock implements ToolkitLock { private static final RecursiveLock globalLock = LockFactory.createRecursiveLock(); + private static GlobalToolkitLock singleton = new GlobalToolkitLock(); - /** Singleton via {@link NativeWindowFactoryImpl#getGlobalToolkitLock()} */ - protected GlobalToolkitLock() { } + public static final GlobalToolkitLock getSingleton() { + return singleton; + } + + private GlobalToolkitLock() { } @Override public final void lock() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index c35cede77..a3a66b7f1 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -44,16 +44,11 @@ import com.jogamp.common.util.ReflectionUtil.AWTNames; public class NativeWindowFactoryImpl extends NativeWindowFactory { private static final ToolkitLock nullToolkitLock = new NullToolkitLock(); - private static final ToolkitLock globalToolkitLock = new GlobalToolkitLock(); public static ToolkitLock getNullToolkitLock() { return nullToolkitLock; } - public static ToolkitLock getGlobalToolkitLock() { - return globalToolkitLock; - } - // This subclass of NativeWindowFactory handles the case of // NativeWindows being passed in protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException { diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java index 2062d1f58..ed23def8f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java @@ -13,15 +13,11 @@ import javax.media.nativewindow.NativeWindowFactory; public static boolean requiresToolkitLock() {} - public static boolean requiresGlobalToolkitLock() {} + public static boolean hasThreadingIssues() {} * </pre> * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()}, * or {@link NativeWindowFactory#shutdown()} via reflection. * </p> - * <p> - * If <code>requiresGlobalToolkitLock() == true</code>, then - * <code>requiresToolkitLock() == true</code> shall be valid as well. - * </p> */ public interface ToolkitProperties { @@ -46,6 +42,6 @@ public interface ToolkitProperties { /** * Called by {@link NativeWindowFactory#initSingleton()} */ - // boolean requiresGlobalToolkitLock(); + // boolean hasThreadingIssues(); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 67c64a95c..349da8ee6 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -237,18 +237,15 @@ public class JAWTUtil { jawtToolkitLock = new ToolkitLock() { public final void lock() { - NativeWindowFactory.getGlobalToolkitLock().lock(); JAWTUtil.lockToolkit(); if(TRACE_LOCK) { System.err.println("JAWTToolkitLock.lock()"); } } public final void unlock() { if(TRACE_LOCK) { System.err.println("JAWTToolkitLock.unlock()"); } JAWTUtil.unlockToolkit(); - NativeWindowFactory.getGlobalToolkitLock().unlock(); } @Override public final void validateLocked() throws RuntimeException { - NativeWindowFactory.getGlobalToolkitLock().validateLocked(); JAWTUtil.validateLocked(); } public final void dispose() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index 481cbbe39..a195f137e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -76,7 +76,7 @@ public class OSXUtil implements ToolkitProperties { * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ - public static final boolean requiresGlobalToolkitLock() { return false; } + public static final boolean hasThreadingIssues() { return false; } public static boolean isNSView(long object) { return isNSView0(object); diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java index 4408a0903..2f4e18359 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java @@ -84,7 +84,7 @@ public class GDIUtil implements ToolkitProperties { * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ - public static final boolean requiresGlobalToolkitLock() { return false; } + public static final boolean hasThreadingIssues() { return false; } private static RegisteredClass dummyWindowClass = null; private static Object dummyWindowSync = new Object(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 103995a8d..c771cd67a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -95,7 +95,7 @@ public class X11Util implements ToolkitProperties { private static String nullDisplayName = null; private static volatile boolean isInit = false; private static boolean markAllDisplaysUnclosable = false; // ATI/AMD X11 driver issues - private static boolean requiresGlobalToolkitLock = false; // ATI/AMD X11 driver issues + private static boolean hasThreadingIssues = false; // ATI/AMD X11 driver issues private static Object setX11ErrorHandlerLock = new Object(); private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI"; @@ -137,7 +137,7 @@ public class X11Util implements ToolkitProperties { hasX11_EXTENSION_ATIFGLRXDRI = false; hasX11_EXTENSION_ATIFGLEXTENSION = false; } - requiresGlobalToolkitLock = ATI_HAS_MULTITHREADING_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION ); + hasThreadingIssues = ATI_HAS_MULTITHREADING_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION ); markAllDisplaysUnclosable = ATI_HAS_XCLOSEDISPLAY_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION ); if(DEBUG) { @@ -147,7 +147,7 @@ public class X11Util implements ToolkitProperties { ",\n\t X11_EXTENSION_ATIFGLRXDRI " + hasX11_EXTENSION_ATIFGLRXDRI+ ",\n\t X11_EXTENSION_ATIFGLEXTENSION " + hasX11_EXTENSION_ATIFGLEXTENSION+ ",\n\t requiresToolkitLock "+requiresToolkitLock()+ - ",\n\t requiresGlobalToolkitLock "+requiresGlobalToolkitLock()+ + ",\n\t hasThreadingIssues "+hasThreadingIssues()+ ",\n\t markAllDisplaysUnclosable "+getMarkAllDisplaysUnclosable() ); // Thread.dumpStack(); @@ -228,8 +228,8 @@ public class X11Util implements ToolkitProperties { * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ - public static final boolean requiresGlobalToolkitLock() { - return requiresGlobalToolkitLock; // JAWT locking: yes, instead of native X11 locking w use a global lock. + public static final boolean hasThreadingIssues() { + return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere" } public static void setX11ErrorHandler(boolean onoff, boolean quiet) { |