예제 #1
0
파일: Timer.cs 프로젝트: jcapellman/coreclr
        internal TimerQueueTimer(TimerCallback timerCallback, object state, uint dueTime, uint period)
        {
            m_timerCallback        = timerCallback;
            m_state                = state;
            m_dueTime              = Timeout.UnsignedInfinite;
            m_period               = Timeout.UnsignedInfinite;
            m_executionContext     = ExecutionContext.Capture();
            m_associatedTimerQueue = TimerQueue.Instances[RuntimeThread.GetCurrentProcessorId() % TimerQueue.Instances.Length];

            //
            // After the following statement, the timer may fire.  No more manipulation of timer state outside of
            // the lock is permitted beyond this point!
            //
            if (dueTime != Timeout.UnsignedInfinite)
            {
                Change(dueTime, period);
            }
        }
예제 #2
0
 public static int GetCurrentProcessorId() => RuntimeThread.GetCurrentProcessorId();