Author: mturk Date: Mon May 11 07:17:33 2009 New Revision: 773485 URL: http://svn.apache.org/viewvc?rev=773485&view=rev Log: Attach native threads as daemons and give them a name
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c?rev=773485&r1=773484&r2=773485&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c Mon May 11 07:17:33 2009 @@ -93,7 +93,14 @@ return NULL; if ((*acr_pvm)->GetEnv(acr_pvm, &epp, JNI_VERSION_1_4) == JNI_EDETACHED) { - (*acr_pvm)->AttachCurrentThread(acr_pvm, &epp, NULL); + char tn[32]; + JavaVMAttachArgs aa; + + sprintf(tn, "NativeThread-%u", (unsigned int)pthread_self()); + aa.version = JNI_VERSION_1_4; + aa.name = tn; + aa.group = NULL; + (*acr_pvm)->AttachCurrentThreadAsDaemon(acr_pvm, &epp, &aa); tlsd->attached = 1; } else Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=773485&r1=773484&r2=773485&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Mon May 11 07:17:33 2009 @@ -365,7 +365,14 @@ return NULL; if ((*acr_pvm)->GetEnv(acr_pvm, &epp, JNI_VERSION_1_4) == JNI_EDETACHED) { - (*acr_pvm)->AttachCurrentThread(acr_pvm, &epp, NULL); + char tn[32]; + JavaVMAttachArgs aa; + + sprintf(tn, "NativeThread-%u", GetCurrentThreadId()); + aa.version = JNI_VERSION_1_4; + aa.name = tn; + aa.group = NULL; + (*acr_pvm)->AttachCurrentThreadAsDaemon(acr_pvm, &epp, &aa); tlsd->attached = 1; } tlsd->env = epp;