waitable_timer(bool utcMode) { _utcMode = utcMode; _exited = false; _expireTime = long.MaxValue; _eventsQueue = new Map <long, waitable_event_handle>(true); _timerHandle = CreateWaitableTimer(0, 0, 0); _workEngine = new work_engine(); _timerThread = new Thread(timer_thread); _timerThread.Priority = ThreadPriority.Highest; _timerThread.IsBackground = true; _timerThread.Name = _utcMode ? "UTC定时器" : "系统定时器"; _workEngine.run(1, ThreadPriority.Highest, true, _utcMode ? "UTC定时器调度" : "系统定时器调度"); _timerThread.Start(); }
waitable_timer(bool utcMode) { _utcMode = utcMode; _exited = false; _expireTime = long.MaxValue; _eventsQueue = new Map <long, waitable_event_handle>(true); _timerHandle = CreateWaitableTimer(0, 0, 0); _workEngine = new work_engine(); _workStrand = new work_strand(_workEngine); _timerThread = new Thread(timerThread); _timerThread.Priority = ThreadPriority.Highest; _timerThread.IsBackground = true; _timerThread.Name = _utcMode? "UTC定时器调度" : "系统定时器调度"; _workEngine.run(1, ThreadPriority.Highest, true); _timerThread.Start(); uint MaximumTime = 0, MinimumTime = 0, CurrentTime = 0, ActualTime = 0; if (0 == NtQueryTimerResolution(out MaximumTime, out MinimumTime, out CurrentTime)) { NtSetTimerResolution(MinimumTime, 1, out ActualTime); } }
public work_strand(work_engine eng) : base() { _service = eng.service; }