< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page




3092     return csf.count();
3093   }
3094   // Implied else: if JavaThread is not alive simply return a count of 0.
3095   return 0;
3096 JVM_END
3097 
3098 
3099 JVM_ENTRY(void, JVM_Interrupt(JNIEnv* env, jobject jthread))
3100   JVMWrapper("JVM_Interrupt");
3101 
3102   ThreadsListHandle tlh(thread);
3103   JavaThread* receiver = NULL;
3104   bool is_alive = tlh.cv_internal_thread_to_JavaThread(jthread, &receiver, NULL);
3105   if (is_alive) {
3106     // jthread refers to a live JavaThread.
3107     receiver->interrupt();
3108   }
3109 JVM_END
3110 
3111 
3112 JVM_ENTRY(jboolean, JVM_IsInterrupted(JNIEnv* env, jobject jthread, jboolean clear_interrupted))
3113   JVMWrapper("JVM_IsInterrupted");
3114 
3115   ThreadsListHandle tlh(thread);
3116   JavaThread* receiver = NULL;
3117   bool is_alive = tlh.cv_internal_thread_to_JavaThread(jthread, &receiver, NULL);
3118   if (is_alive) {
3119     // jthread refers to a live JavaThread.
3120     return (jboolean) receiver->is_interrupted(clear_interrupted != 0);
3121   } else {
3122     return JNI_FALSE;
3123   }
3124 JVM_END
3125 
3126 
3127 // Return true iff the current thread has locked the object passed in
3128 
3129 JVM_ENTRY(jboolean, JVM_HoldsLock(JNIEnv* env, jclass threadClass, jobject obj))
3130   JVMWrapper("JVM_HoldsLock");
3131   assert(THREAD->is_Java_thread(), "sanity check");
3132   if (obj == NULL) {
3133     THROW_(vmSymbols::java_lang_NullPointerException(), JNI_FALSE);
3134   }
3135   Handle h_obj(THREAD, JNIHandles::resolve(obj));
3136   return ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, h_obj);
3137 JVM_END
3138 
3139 
3140 JVM_ENTRY(void, JVM_DumpAllStacks(JNIEnv* env, jclass))
3141   JVMWrapper("JVM_DumpAllStacks");
3142   VM_PrintThreads op;
3143   VMThread::execute(&op);
3144   if (JvmtiExport::should_post_data_dump()) {
3145     JvmtiExport::post_data_dump();
3146   }




3092     return csf.count();
3093   }
3094   // Implied else: if JavaThread is not alive simply return a count of 0.
3095   return 0;
3096 JVM_END
3097 
3098 
3099 JVM_ENTRY(void, JVM_Interrupt(JNIEnv* env, jobject jthread))
3100   JVMWrapper("JVM_Interrupt");
3101 
3102   ThreadsListHandle tlh(thread);
3103   JavaThread* receiver = NULL;
3104   bool is_alive = tlh.cv_internal_thread_to_JavaThread(jthread, &receiver, NULL);
3105   if (is_alive) {
3106     // jthread refers to a live JavaThread.
3107     receiver->interrupt();
3108   }
3109 JVM_END
3110 
3111 















3112 // Return true iff the current thread has locked the object passed in
3113 
3114 JVM_ENTRY(jboolean, JVM_HoldsLock(JNIEnv* env, jclass threadClass, jobject obj))
3115   JVMWrapper("JVM_HoldsLock");
3116   assert(THREAD->is_Java_thread(), "sanity check");
3117   if (obj == NULL) {
3118     THROW_(vmSymbols::java_lang_NullPointerException(), JNI_FALSE);
3119   }
3120   Handle h_obj(THREAD, JNIHandles::resolve(obj));
3121   return ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, h_obj);
3122 JVM_END
3123 
3124 
3125 JVM_ENTRY(void, JVM_DumpAllStacks(JNIEnv* env, jclass))
3126   JVMWrapper("JVM_DumpAllStacks");
3127   VM_PrintThreads op;
3128   VMThread::execute(&op);
3129   if (JvmtiExport::should_post_data_dump()) {
3130     JvmtiExport::post_data_dump();
3131   }


< prev index next >