diff options
Diffstat (limited to 'Java/phidget_jni.c')
-rw-r--r-- | Java/phidget_jni.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Java/phidget_jni.c b/Java/phidget_jni.c index 1ec7ca6..1a91e74 100644 --- a/Java/phidget_jni.c +++ b/Java/phidget_jni.c @@ -27,6 +27,13 @@ jmethodID serverConnectEvent_cons; jclass serverDisconnectEvent_class; jmethodID serverDisconnectEvent_cons; +#ifdef _WINDOWS + +extern int useThreadSecurity; +extern void destroyThreadSecurityAttributes(); + +#endif + jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { @@ -36,6 +43,12 @@ JNI_OnLoad(JavaVM *vm, void *reserved) ph_vm = vm; + // Don't set thread security when we're using Java - this break events. + #ifdef _WINDOWS + useThreadSecurity = PFALSE; + destroyThreadSecurityAttributes(); + #endif + result = (*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_4); if(result == JNI_EDETACHED) |