Top


定義場所(file name)

hotspot/src/share/vm/runtime/os.cpp

説明(description)

// The INITIALIZED state is distinguished from the SUSPENDED state because the
// conditions in which a thread is first started are different from those in which
// a suspension is resumed.  These differences make it hard for us to apply the
// tougher checks when starting threads that we want to do when resuming them.
// However, when start_thread is called as a result of Thread.start, on a Java
// thread, the operation is synchronized on the Java Thread object.  So there
// cannot be a race to start the thread and hence for the thread to exit while
// we are working on it.  Non-Java threads that start Java threads either have
// to do so in a context in which races are impossible, or should do appropriate
// locking.

名前(function name)

void os::start_thread(Thread* thread) {

本体部(body)

  {- -------------------------------------------
  (1) OSThread::set_state() で処理対象の OSThread の状態を RUNNABLE に変更した後, 
      os::pd_start_thread() で実際にスレッドの処理を開始させる.

      (なお, 以上の処理は, 処理対象の Thread の SR_lock で排他して行う)
      ---------------------------------------- -}

      // guard suspend/resume
      MutexLockerEx ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
      OSThread* osthread = thread->osthread();
      osthread->set_state(RUNNABLE);
      pd_start_thread(thread);
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.