src/hotspot/os/aix/os_aix.cpp
changeset 52302 912b79d983d9
parent 52109 101c2b6eacbe
child 52581 d402a406bbc3
equal deleted inserted replaced
52301:fbfcdc5bf694 52302:912b79d983d9
   774 // create new thread
   774 // create new thread
   775 
   775 
   776 // Thread start routine for all newly created threads
   776 // Thread start routine for all newly created threads
   777 static void *thread_native_entry(Thread *thread) {
   777 static void *thread_native_entry(Thread *thread) {
   778 
   778 
   779   // find out my own stack dimensions
   779   thread->record_stack_base_and_size();
   780   {
       
   781     // actually, this should do exactly the same as thread->record_stack_base_and_size...
       
   782     thread->set_stack_base(os::current_stack_base());
       
   783     thread->set_stack_size(os::current_stack_size());
       
   784   }
       
   785 
   780 
   786   const pthread_t pthread_id = ::pthread_self();
   781   const pthread_t pthread_id = ::pthread_self();
   787   const tid_t kernel_thread_id = ::thread_self();
   782   const tid_t kernel_thread_id = ::thread_self();
   788 
   783 
   789   LogTarget(Info, os, thread) lt;
   784   LogTarget(Info, os, thread) lt;
   832   os::Aix::init_thread_fpu_state();
   827   os::Aix::init_thread_fpu_state();
   833 
   828 
   834   assert(osthread->get_state() == RUNNABLE, "invalid os thread state");
   829   assert(osthread->get_state() == RUNNABLE, "invalid os thread state");
   835 
   830 
   836   // Call one more level start routine.
   831   // Call one more level start routine.
   837   thread->run();
   832   thread->call_run();
       
   833 
       
   834   // Note: at this point the thread object may already have deleted itself.
       
   835   // Prevent dereferencing it from here on out.
       
   836   thread = NULL;
   838 
   837 
   839   log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
   838   log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
   840     os::current_thread_id(), (uintx) kernel_thread_id);
   839     os::current_thread_id(), (uintx) kernel_thread_id);
   841 
       
   842   // If a thread has not deleted itself ("delete this") as part of its
       
   843   // termination sequence, we have to ensure thread-local-storage is
       
   844   // cleared before we actually terminate. No threads should ever be
       
   845   // deleted asynchronously with respect to their termination.
       
   846   if (Thread::current_or_null_safe() != NULL) {
       
   847     assert(Thread::current_or_null_safe() == thread, "current thread is wrong");
       
   848     thread->clear_thread_current();
       
   849   }
       
   850 
   840 
   851   return 0;
   841   return 0;
   852 }
   842 }
   853 
   843 
   854 bool os::create_thread(Thread* thread, ThreadType thr_type,
   844 bool os::create_thread(Thread* thread, ThreadType thr_type,