< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page

        

*** 877,888 **** state |= JVMTI_THREAD_STATE_SUSPENDED; } if (jts == _thread_in_native) { state |= JVMTI_THREAD_STATE_IN_NATIVE; } ! OSThread* osThread = java_thread->osthread(); ! if (osThread != NULL && osThread->interrupted()) { state |= JVMTI_THREAD_STATE_INTERRUPTED; } } *thread_state_ptr = state; --- 877,887 ---- state |= JVMTI_THREAD_STATE_SUSPENDED; } if (jts == _thread_in_native) { state |= JVMTI_THREAD_STATE_IN_NATIVE; } ! if (java_thread->is_interrupted(false)) { state |= JVMTI_THREAD_STATE_INTERRUPTED; } } *thread_state_ptr = state;
*** 1090,1108 **** // Threads_lock NOT held // thread - NOT pre-checked jvmtiError JvmtiEnv::InterruptThread(jthread thread) { - // TODO: this is very similar to JVM_Interrupt(); share code in future JavaThread* current_thread = JavaThread::current(); JavaThread* java_thread = NULL; ThreadsListHandle tlh(current_thread); jvmtiError err = JvmtiExport::cv_external_thread_to_JavaThread(tlh.list(), thread, &java_thread, NULL); if (err != JVMTI_ERROR_NONE) { return err; } ! java_thread->interrupt(); return JVMTI_ERROR_NONE; } /* end InterruptThread */ --- 1089,1110 ---- // Threads_lock NOT held // thread - NOT pre-checked jvmtiError JvmtiEnv::InterruptThread(jthread thread) { JavaThread* current_thread = JavaThread::current(); JavaThread* java_thread = NULL; ThreadsListHandle tlh(current_thread); jvmtiError err = JvmtiExport::cv_external_thread_to_JavaThread(tlh.list(), thread, &java_thread, NULL); if (err != JVMTI_ERROR_NONE) { return err; } ! // Really this should be a Java call to Thread.interrupt to ensure the same ! // semantics, however historically this has not been done for some reason. ! // So we continue with that (which means we don't interact with any Java-level ! // Interruptible object) but we must set the Java-level interrupted state. ! java_lang_Thread::set_interrupted(JNIHandles::resolve(thread), true); java_thread->interrupt(); return JVMTI_ERROR_NONE; } /* end InterruptThread */
< prev index next >