aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-12 10:55:54 +0200
committerSven Gothel <[email protected]>2011-10-12 10:55:54 +0200
commit4d0c6cfe9abd8036c00e09e280605d7c5acbbf93 (patch)
treefe20933b9470d4c386e9f2ff65d0057799eb5adf
parentafec120a6fbb277025372a052955f97c225f0a9d (diff)
OSX Minor Cleanups: ctx delete note (freeze when shared ctx), Better MainThread Thread name[s]
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface.m8
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.c2
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MainThread.java20
3 files changed, 16 insertions, 14 deletions
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
index 5973ca45b..86d875502 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
@@ -590,7 +590,7 @@ Bool deleteContext(void* nsJContext) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[nsContext clearDrawable];
- [nsContext release];
+ [nsContext release]; // freezes for a few seconds if ctx is shared
[pool release];
return true;
}
@@ -656,15 +656,9 @@ void* createPBuffer(int renderTarget, int internalFormat, int width, int height)
}
Bool destroyPBuffer(void* buffer) {
- /* FIXME: not clear whether we need to perform the clearDrawable below */
NSOpenGLPixelBuffer *pBuffer = (NSOpenGLPixelBuffer*)buffer;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- /*
- if (nsContext != NULL) {
- [nsContext clearDrawable];
- }
- */
[pBuffer release];
[pool release];
diff --git a/src/nativewindow/native/macosx/OSXmisc.c b/src/nativewindow/native/macosx/OSXmisc.c
index 46a853844..8c558272d 100644
--- a/src/nativewindow/native/macosx/OSXmisc.c
+++ b/src/nativewindow/native/macosx/OSXmisc.c
@@ -69,7 +69,7 @@ Java_jogamp_nativewindow_macosx_OSXUtil_initIDs0(JNIEnv *env, jclass _unused) {
}
/*
- * Class: jogamp_newt_driver_macosx_MacWindow
+ * Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: getLocationOnScreenImpl0
* Signature: (JII)Ljavax/media/nativewindow/util/Point;
*/
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());