Name: rm29839 Date: 07/08/98
Hi,
I'm trying to use the GetThreadStatus native call.
I make a wrapper for GetThreadStatus in a .c file :
JNIEXPORT jint JNICALL Java_deadlockMonitor_myGetThreadStatus
(JNIEnv *env, jobject caller, jobject thread) {
jint stat;
jvmdiError err;
err = JVMDI_GetThreadStatus(env, thread, &stat);
return (err+stat);
}
And then call it on the java side as follows:
public static void main (String [] args) {
Thread t = new mythread (); // has something in the run method
try {
t.sleep (5000);
catch (Exception e) {}
int stat = myGetThreadStatus (t);
System.out.println ("stat = " + stat);
}
And run it, I get a "4" (WAIT) when I would expect a "2" (SLEEPING).
I've tried changing thread priorities, but this doesn't help. In short, I've never seen this function return a
THREAD_STATUS_SLEEPING. I don't think I'm doing anything wrong here...
Just thought you should know,
Gordon
(Review ID: 34690)
======================================================================