zircon/kernel/object/thread_dispatcher.cc
void ThreadDispatcher::Exit() {
  canary_.Assert();

  LTRACE_ENTRY_OBJ;

  // only valid to call this on the current thread
  DEBUG_ASSERT(get_current_thread() == core_thread_);

  {
    Guard<fbl::Mutex> guard{get_lock()};

    SetStateLocked(ThreadState::Lifecycle::DYING);
  }

  // exit here
  // this will recurse back to us in ::Exiting()
  thread_exit(0);

  __UNREACHABLE;
}
// called in the context of our thread
called in the context of our thread
called in the context of our thread
void ThreadDispatcher::Exit() {
  canary_.Assert();
  LTRACE_ENTRY_OBJ;
  DEBUG_ASSERT(get_current_thread() == core_thread_);
  {
    Guard<fbl::Mutex> guard{get_lock()};
    SetStateLocked(ThreadState::Lifecycle::DYING);
  }
  thread_exit(0);
  __UNREACHABLE;
}
void ThreadDispatcher :: Exit ( ) { canary_ . Assert ( ) ; LTRACE_ENTRY_OBJ ; DEBUG_ASSERT ( get_current_thread ( ) == core_thread_ ) ; { Guard < fbl :: Mutex > guard { get_lock ( ) } ; SetStateLocked ( ThreadState :: Lifecycle :: DYING ) ; } thread_exit ( 0 ) ; __UNREACHABLE ; }
called in the context of our thread
called in the context of our thread
// only valid to call this on the current thread // exit here // this will recurse back to us in ::Exiting()