예제 #1
0
        private static void OnThreadExit()
        {
            Thread currentThread = t_currentThread;

            if (currentThread != null)
            {
                // Inform the wait subsystem that the thread is exiting. For instance, this would abandon any mutexes locked by
                // the thread.
                WaitSubsystem.OnThreadExiting(currentThread);

                // Set the Stopped bit and signal the current thread as stopped
                int state = currentThread._threadState;
                if ((state & (int)(ThreadState.Stopped | ThreadState.Aborted)) == 0)
                {
                    currentThread.SetThreadStateBit(ThreadState.Stopped);
                }
                currentThread._stopped.Set();
            }
        }