hotspot/src/share/vm/runtime/thread.cpp
changeset 26834 41332d860d6a
parent 26684 d1221849ea3d
child 27247 99db666dbe8e
child 27164 6523fa019ffa
equal deleted inserted replaced
26833:fa1e0d1c960f 26834:41332d860d6a
   824     int os_prio;
   824     int os_prio;
   825     if (os::get_native_priority(this, &os_prio) == OS_OK) {
   825     if (os::get_native_priority(this, &os_prio) == OS_OK) {
   826       st->print("os_prio=%d ", os_prio);
   826       st->print("os_prio=%d ", os_prio);
   827     }
   827     }
   828     st->print("tid=" INTPTR_FORMAT " ", this);
   828     st->print("tid=" INTPTR_FORMAT " ", this);
       
   829     ext().print_on(st);
   829     osthread()->print_on(st);
   830     osthread()->print_on(st);
   830   }
   831   }
   831   debug_only(if (WizardMode) print_owned_locks_on(st);)
   832   debug_only(if (WizardMode) print_owned_locks_on(st);)
   832 }
   833 }
   833 
   834 
  2962   }
  2963   }
  2963 
  2964 
  2964   // Push the Java priority down to the native thread; needs Threads_lock
  2965   // Push the Java priority down to the native thread; needs Threads_lock
  2965   Thread::set_priority(this, prio);
  2966   Thread::set_priority(this, prio);
  2966 
  2967 
       
  2968   prepare_ext();
       
  2969 
  2967   // Add the new thread to the Threads list and set it in motion.
  2970   // Add the new thread to the Threads list and set it in motion.
  2968   // We must have threads lock in order to call Threads::add.
  2971   // We must have threads lock in order to call Threads::add.
  2969   // It is crucial that we do not block before the thread is
  2972   // It is crucial that we do not block before the thread is
  2970   // added to the Threads list for if a GC happens, then the java_thread oop
  2973   // added to the Threads list for if a GC happens, then the java_thread oop
  2971   // will not be visited by GC.
  2974   // will not be visited by GC.
  3792     } else {
  3795     } else {
  3793       vm_exit_during_initialization("Could not find JVM_OnLoad function in -Xrun library", agent->name());
  3796       vm_exit_during_initialization("Could not find JVM_OnLoad function in -Xrun library", agent->name());
  3794     }
  3797     }
  3795   }
  3798   }
  3796 }
  3799 }
       
  3800 
       
  3801 JavaThread* Threads::find_java_thread_from_java_tid(jlong java_tid) {
       
  3802   assert(Threads_lock->owned_by_self(), "Must hold Threads_lock");
       
  3803 
       
  3804   JavaThread* java_thread = NULL;
       
  3805   // Sequential search for now.  Need to do better optimization later.
       
  3806   for (JavaThread* thread = Threads::first(); thread != NULL; thread = thread->next()) {
       
  3807     oop tobj = thread->threadObj();
       
  3808     if (!thread->is_exiting() &&
       
  3809         tobj != NULL &&
       
  3810         java_tid == java_lang_Thread::thread_id(tobj)) {
       
  3811       java_thread = thread;
       
  3812       break;
       
  3813     }
       
  3814   }
       
  3815   return java_thread;
       
  3816 }
       
  3817 
  3797 
  3818 
  3798 // Last thread running calls java.lang.Shutdown.shutdown()
  3819 // Last thread running calls java.lang.Shutdown.shutdown()
  3799 void JavaThread::invoke_shutdown_hooks() {
  3820 void JavaThread::invoke_shutdown_hooks() {
  3800   HandleMark hm(this);
  3821   HandleMark hm(this);
  3801 
  3822