< prev index next >

src/share/vm/runtime/thread.cpp

Print this page




 357 #endif // INCLUDE_NMT
 358 
 359   // deallocate data structures
 360   delete resource_area();
 361   // since the handle marks are using the handle area, we have to deallocated the root
 362   // handle mark before deallocating the thread's handle area,
 363   assert(last_handle_mark() != NULL, "check we have an element");
 364   delete last_handle_mark();
 365   assert(last_handle_mark() == NULL, "check we have reached the end");
 366 
 367   // It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
 368   // We NULL out the fields for good hygiene.
 369   ParkEvent::Release(_ParkEvent); _ParkEvent   = NULL;
 370   ParkEvent::Release(_SleepEvent); _SleepEvent  = NULL;
 371   ParkEvent::Release(_MutexEvent); _MutexEvent  = NULL;
 372   ParkEvent::Release(_MuxEvent); _MuxEvent    = NULL;
 373 
 374   delete handle_area();
 375   delete metadata_handles();
 376 





 377   // osthread() can be NULL, if creation of thread failed.
 378   if (osthread() != NULL) os::free_thread(osthread());
 379 
 380   delete _SR_lock;
 381 
 382   // clear Thread::current if thread is deleting itself.
 383   // Needed to ensure JNI correctly detects non-attached threads.
 384   if (this == Thread::current()) {
 385     clear_thread_current();
 386   }
 387 
 388   CHECK_UNHANDLED_OOPS_ONLY(if (CheckUnhandledOops) delete unhandled_oops();)
 389 }
 390 
 391 // NOTE: dummy function for assertion purpose.
 392 void Thread::run() {
 393   ShouldNotReachHere();
 394 }
 395 
 396 #ifdef ASSERT
 397 // Private method to check for dangling thread pointer
 398 void check_for_dangling_thread_pointer(Thread *thread) {
 399   assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(),
 400          "possibility of dangling Thread pointer");




 357 #endif // INCLUDE_NMT
 358 
 359   // deallocate data structures
 360   delete resource_area();
 361   // since the handle marks are using the handle area, we have to deallocated the root
 362   // handle mark before deallocating the thread's handle area,
 363   assert(last_handle_mark() != NULL, "check we have an element");
 364   delete last_handle_mark();
 365   assert(last_handle_mark() == NULL, "check we have reached the end");
 366 
 367   // It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
 368   // We NULL out the fields for good hygiene.
 369   ParkEvent::Release(_ParkEvent); _ParkEvent   = NULL;
 370   ParkEvent::Release(_SleepEvent); _SleepEvent  = NULL;
 371   ParkEvent::Release(_MutexEvent); _MutexEvent  = NULL;
 372   ParkEvent::Release(_MuxEvent); _MuxEvent    = NULL;
 373 
 374   delete handle_area();
 375   delete metadata_handles();
 376 
 377   // SR_handler uses this as a termination indicator -
 378   // needs to happen before os::free_thread()
 379   delete _SR_lock;
 380   _SR_lock = NULL;
 381 
 382   // osthread() can be NULL, if creation of thread failed.
 383   if (osthread() != NULL) os::free_thread(osthread());


 384 
 385   // clear Thread::current if thread is deleting itself.
 386   // Needed to ensure JNI correctly detects non-attached threads.
 387   if (this == Thread::current()) {
 388     clear_thread_current();
 389   }
 390 
 391   CHECK_UNHANDLED_OOPS_ONLY(if (CheckUnhandledOops) delete unhandled_oops();)
 392 }
 393 
 394 // NOTE: dummy function for assertion purpose.
 395 void Thread::run() {
 396   ShouldNotReachHere();
 397 }
 398 
 399 #ifdef ASSERT
 400 // Private method to check for dangling thread pointer
 401 void check_for_dangling_thread_pointer(Thread *thread) {
 402   assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(),
 403          "possibility of dangling Thread pointer");


< prev index next >