< prev index next >

src/share/vm/prims/jvm.cpp

Print this page

        

*** 3178,3197 **** if (JvmtiExport::should_post_data_dump()) { JvmtiExport::post_data_dump(); } JVM_END ! JVM_ENTRY(void, JVM_SetNativeThreadName(JNIEnv* env, jobject jthread, jstring name)) JVMWrapper("JVM_SetNativeThreadName"); ResourceMark rm(THREAD); oop java_thread = JNIHandles::resolve_non_null(jthread); JavaThread* thr = java_lang_Thread::thread(java_thread); // Thread naming only supported for the current thread, doesn't work for // target threads. ! if (Thread::current() == thr && !thr->has_attached_via_jni()) { ! // we don't set the name of an attached thread to avoid stepping ! // on other programs const char *thread_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(name)); os::set_native_thread_name(thread_name); } JVM_END --- 3178,3199 ---- if (JvmtiExport::should_post_data_dump()) { JvmtiExport::post_data_dump(); } JVM_END ! JVM_ENTRY(void, JVM_SetNativeThreadName(JNIEnv* env, jobject jthread, jstring name, jboolean allowAttachedThread)) JVMWrapper("JVM_SetNativeThreadName"); ResourceMark rm(THREAD); oop java_thread = JNIHandles::resolve_non_null(jthread); JavaThread* thr = java_lang_Thread::thread(java_thread); // Thread naming only supported for the current thread, doesn't work for // target threads. ! if (Thread::current() == thr && (allowAttachedThread || !thr->has_attached_via_jni())) { ! // Sets the native thread name for a JavaThread. If specifically ! // requested JNI-attached threads can also have their native name set; ! // otherwise we do not modify JNI-attached threads as it may interfere ! // with the application that created them. const char *thread_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(name)); os::set_native_thread_name(thread_name); } JVM_END
< prev index next >