DetachCurrentThread corrupts, DestroyJavaVM waits!

Hello Guys!

In my static library I create 2 threads. ThreadX and ThreadY.

BothTheadX andThreadY make JNI calls to a DLL.

ThreadX and ThreadY are as follows:

ThreadX ThreadY

- -

AttachCurrentThread AttachCurrentThread

......

JNI CallsJNI Calls

......

DetachCurrentThread DetachCurrentThread

- -

However,ThreadYexits first (i.e. callsThreadY's DetachCurrentThread), after thisThreadX's further calls to JNI fails (BAD ACCESS Error)

Any solution for this?

Nowif I remove DetachCurrentThread call from these 2 threads, then my DestroyJavaVM waits for infinite time.

And if I mistake not, even after Detaching both the Threads, DestroyJavaVM still waits for release of some more resources/handles. (not very sure about this one)

Any pointers?

Please guide!

Thanks & Regards,

Pacific

[986 byte] By [a1prashanta] at [2007-10-3 1:06:18]
# 1
Some more info:Information about the OS:Microsoft windows XP-SP2 andMacintosh 10.3.XCompiler:On XP: Microsoft Visual Studio 2005On Mac: XCODE
a1prashanta at 2007-7-14 18:02:51 > top of Java-index,Java HotSpot Virtual Machine,Specifications...