< prev index next >

src/share/vm/runtime/thread.cpp

Print this page

        

@@ -334,13 +334,10 @@
     p2i(stack_base()), stack_size()/1024);
 }
 
 
 Thread::~Thread() {
-  // Reclaim the objectmonitors from the omFreeList of the moribund thread.
-  ObjectSynchronizer::omFlush(this);
-
   EVENT_THREAD_DESTRUCT(this);
 
   // stack_base can be NULL if the thread is never started or exited before
   // record_stack_base_and_size called. Although, we would like to ensure
   // that all started threads do call record_stack_base_and_size(), there is

@@ -4249,10 +4246,14 @@
   // Possible GC point.
   Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p));
 }
 
 void Threads::remove(JavaThread* p) {
+
+  // Reclaim the objectmonitors from the omFreeList of the moribund thread.
+  ObjectSynchronizer::omFlush(p);
+
   // Extra scope needed for Thread_lock, so we can check
   // that we do not remove thread without safepoint code notice
   { MutexLocker ml(Threads_lock);
 
     assert(includes(p), "p must be present");
< prev index next >