diff options
author | Sven Gothel <[email protected]> | 2011-10-12 10:55:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-12 10:55:54 +0200 |
commit | 4d0c6cfe9abd8036c00e09e280605d7c5acbbf93 (patch) | |
tree | fe20933b9470d4c386e9f2ff65d0057799eb5adf /src/newt/classes | |
parent | afec120a6fbb277025372a052955f97c225f0a9d (diff) |
OSX Minor Cleanups: ctx delete note (freeze when shared ctx), Better MainThread Thread name[s]
Diffstat (limited to 'src/newt/classes')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/util/MainThread.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 8de77420f..c7780b0d8 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -112,19 +112,21 @@ public class MainThread { private static final MainThread singletonMainThread = new MainThread(); // one singleton MainThread - static class MainAction extends Thread { + static class UserApp extends Thread { private String mainClassName; private String[] mainClassArgs; private Method mainClassMain; - public MainAction(String mainClassName, String[] mainClassArgs) { + public UserApp(String mainClassName, String[] mainClassArgs) { this.mainClassName=mainClassName; this.mainClassArgs=mainClassArgs; } @Override public void run() { + setName(getName()+"-UserApp"); + if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" start"); // start user app .. try { @@ -154,17 +156,19 @@ public class MainThread { } } } - private static MainAction mainAction; + private static UserApp mainAction; /** Your new java application main entry, which pipelines your application */ public static void main(String[] args) { + final Thread cur = Thread.currentThread(); + useMainThread = HINT_USE_MAIN_THREAD; final Platform.OSType osType = Platform.getOSType(); final boolean isMacOSX = osType == Platform.OSType.MACOS; if(DEBUG) { - System.err.println("MainThread.main(): "+Thread.currentThread().getName()+ + System.err.println("MainThread.main(): "+cur.getName()+ ", useMainThread "+ useMainThread + ", HINT_USE_MAIN_THREAD "+ HINT_USE_MAIN_THREAD + ", isAWTAvailable " + NativeWindowFactory.isAWTAvailable() + ", ostype "+osType+", isMacOSX "+isMacOSX); @@ -184,7 +188,7 @@ public class MainThread { System.arraycopy(args, 1, mainClassArgs, 0, args.length-1); } - mainAction = new MainAction(mainClassName, mainClassArgs); + mainAction = new UserApp(mainClassName, mainClassArgs); if(isMacOSX) { ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton", @@ -192,13 +196,17 @@ public class MainThread { } if ( useMainThread ) { + try { + cur.setName(cur.getName()+"-MainThread"); + } catch (Exception e) {} + // dispatch user's main thread .. mainAction.start(); if(isMacOSX) { try { if(DEBUG) { - System.err.println("MainThread.main(): "+Thread.currentThread().getName()+"- runNSApp"); + System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp"); } ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication", null, null, MainThread.class.getClassLoader()); |