2858 // JavaThread constructor. 2859 if (native_thread->osthread() != NULL) { 2860 // Note: the current thread is not being used within "prepare". 2861 native_thread->prepare(jthread); 2862 } 2863 } 2864 } 2865 2866 if (throw_illegal_thread_state) { 2867 THROW(vmSymbols::java_lang_IllegalThreadStateException()); 2868 } 2869 2870 assert(native_thread != NULL, "Starting null thread?"); 2871 2872 if (native_thread->osthread() == NULL) { 2873 // No one should hold a reference to the 'native_thread'. 2874 delete native_thread; 2875 if (JvmtiExport::should_post_resource_exhausted()) { 2876 JvmtiExport::post_resource_exhausted( 2877 JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_THREADS, 2878 "unable to create new native thread"); 2879 } 2880 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), 2881 "unable to create new native thread"); 2882 } 2883 2884 Thread::start(native_thread); 2885 2886 JVM_END 2887 2888 // JVM_Stop is implemented using a VM_Operation, so threads are forced to safepoints 2889 // before the quasi-asynchronous exception is delivered. This is a little obtrusive, 2890 // but is thought to be reliable and simple. In the case, where the receiver is the 2891 // same thread as the sender, no safepoint is needed. 2892 JVM_ENTRY(void, JVM_StopThread(JNIEnv* env, jobject jthread, jobject throwable)) 2893 JVMWrapper("JVM_StopThread"); 2894 2895 oop java_throwable = JNIHandles::resolve(throwable); 2896 if (java_throwable == NULL) { 2897 THROW(vmSymbols::java_lang_NullPointerException()); 2898 } 2899 oop java_thread = JNIHandles::resolve_non_null(jthread); 2900 JavaThread* receiver = java_lang_Thread::thread(java_thread); 2901 Events::log_exception(JavaThread::current(), | 2858 // JavaThread constructor. 2859 if (native_thread->osthread() != NULL) { 2860 // Note: the current thread is not being used within "prepare". 2861 native_thread->prepare(jthread); 2862 } 2863 } 2864 } 2865 2866 if (throw_illegal_thread_state) { 2867 THROW(vmSymbols::java_lang_IllegalThreadStateException()); 2868 } 2869 2870 assert(native_thread != NULL, "Starting null thread?"); 2871 2872 if (native_thread->osthread() == NULL) { 2873 // No one should hold a reference to the 'native_thread'. 2874 delete native_thread; 2875 if (JvmtiExport::should_post_resource_exhausted()) { 2876 JvmtiExport::post_resource_exhausted( 2877 JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_THREADS, 2878 os::native_thread_creation_failed_msg()); 2879 } 2880 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), 2881 os::native_thread_creation_failed_msg()); 2882 } 2883 2884 Thread::start(native_thread); 2885 2886 JVM_END 2887 2888 // JVM_Stop is implemented using a VM_Operation, so threads are forced to safepoints 2889 // before the quasi-asynchronous exception is delivered. This is a little obtrusive, 2890 // but is thought to be reliable and simple. In the case, where the receiver is the 2891 // same thread as the sender, no safepoint is needed. 2892 JVM_ENTRY(void, JVM_StopThread(JNIEnv* env, jobject jthread, jobject throwable)) 2893 JVMWrapper("JVM_StopThread"); 2894 2895 oop java_throwable = JNIHandles::resolve(throwable); 2896 if (java_throwable == NULL) { 2897 THROW(vmSymbols::java_lang_NullPointerException()); 2898 } 2899 oop java_thread = JNIHandles::resolve_non_null(jthread); 2900 JavaThread* receiver = java_lang_Thread::thread(java_thread); 2901 Events::log_exception(JavaThread::current(), |