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); } }
public static int GetCurrentProcessorId() => RuntimeThread.GetCurrentProcessorId();