515 }
516
517 KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
518 JavaCalls::call_special(&result,
519 thread_group,
520 group,
521 vmSymbols::add_method_name(),
522 vmSymbols::thread_void_signature(),
523 thread_oop, // ARG 1
524 THREAD);
525 if (has_init_error(THREAD)) {
526 return;
527 }
528
529 { MutexLocker mu(Threads_lock);
530 JavaThread* listener_thread = new JavaThread(&attach_listener_thread_entry);
531
532 // Check that thread and osthread were created
533 if (listener_thread == NULL || listener_thread->osthread() == NULL) {
534 vm_exit_during_initialization("java.lang.OutOfMemoryError",
535 "unable to create new native thread");
536 }
537
538 java_lang_Thread::set_thread(thread_oop(), listener_thread);
539 java_lang_Thread::set_daemon(thread_oop());
540
541 listener_thread->set_threadObj(thread_oop());
542 Threads::add(listener_thread);
543 Thread::start(listener_thread);
544 }
545 }
546
547 // Performs clean-up tasks on platforms where we can detect that the last
548 // client has detached
549 void AttachListener::detachall() {
550 // call the platform dependent clean-up
551 pd_detachall();
552 }
|
515 }
516
517 KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
518 JavaCalls::call_special(&result,
519 thread_group,
520 group,
521 vmSymbols::add_method_name(),
522 vmSymbols::thread_void_signature(),
523 thread_oop, // ARG 1
524 THREAD);
525 if (has_init_error(THREAD)) {
526 return;
527 }
528
529 { MutexLocker mu(Threads_lock);
530 JavaThread* listener_thread = new JavaThread(&attach_listener_thread_entry);
531
532 // Check that thread and osthread were created
533 if (listener_thread == NULL || listener_thread->osthread() == NULL) {
534 vm_exit_during_initialization("java.lang.OutOfMemoryError",
535 os::native_thread_creation_failed_msg());
536 }
537
538 java_lang_Thread::set_thread(thread_oop(), listener_thread);
539 java_lang_Thread::set_daemon(thread_oop());
540
541 listener_thread->set_threadObj(thread_oop());
542 Threads::add(listener_thread);
543 Thread::start(listener_thread);
544 }
545 }
546
547 // Performs clean-up tasks on platforms where we can detect that the last
548 // client has detached
549 void AttachListener::detachall() {
550 // call the platform dependent clean-up
551 pd_detachall();
552 }
|