4440 oop threadObj = p->threadObj();
4441 bool daemon = true;
4442 // Bootstrapping problem: threadObj can be null for initial
4443 // JavaThread (or for threads attached via JNI)
4444 if ((!force_daemon) && !is_daemon((threadObj))) {
4445 _number_of_non_daemon_threads++;
4446 daemon = false;
4447 }
4448
4449 ThreadService::add_thread(p, daemon);
4450
4451 // Maintain fast thread list
4452 ThreadsSMRSupport::add_thread(p);
4453
4454 // Possible GC point.
4455 Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p));
4456 }
4457
4458 void Threads::remove(JavaThread* p) {
4459
4460 // Reclaim the objectmonitors from the omInUseList and omFreeList of the moribund thread.
4461 ObjectSynchronizer::omFlush(p);
4462
4463 // Extra scope needed for Thread_lock, so we can check
4464 // that we do not remove thread without safepoint code notice
4465 { MutexLocker ml(Threads_lock);
4466
4467 assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present");
4468
4469 // Maintain fast thread list
4470 ThreadsSMRSupport::remove_thread(p);
4471
4472 JavaThread* current = _thread_list;
4473 JavaThread* prev = NULL;
4474
4475 while (current != p) {
4476 prev = current;
4477 current = current->next();
4478 }
4479
4480 if (prev) {
|
4440 oop threadObj = p->threadObj();
4441 bool daemon = true;
4442 // Bootstrapping problem: threadObj can be null for initial
4443 // JavaThread (or for threads attached via JNI)
4444 if ((!force_daemon) && !is_daemon((threadObj))) {
4445 _number_of_non_daemon_threads++;
4446 daemon = false;
4447 }
4448
4449 ThreadService::add_thread(p, daemon);
4450
4451 // Maintain fast thread list
4452 ThreadsSMRSupport::add_thread(p);
4453
4454 // Possible GC point.
4455 Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p));
4456 }
4457
4458 void Threads::remove(JavaThread* p) {
4459
4460 // Reclaim the ObjectMonitors from the omInUseList and omFreeList of the moribund thread.
4461 ObjectSynchronizer::omFlush(p);
4462
4463 // Extra scope needed for Thread_lock, so we can check
4464 // that we do not remove thread without safepoint code notice
4465 { MutexLocker ml(Threads_lock);
4466
4467 assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present");
4468
4469 // Maintain fast thread list
4470 ThreadsSMRSupport::remove_thread(p);
4471
4472 JavaThread* current = _thread_list;
4473 JavaThread* prev = NULL;
4474
4475 while (current != p) {
4476 prev = current;
4477 current = current->next();
4478 }
4479
4480 if (prev) {
|