Timer that supports overlapped I/O (for IOCP)?

懵懂的女人 提交于 2019-12-04 09:02:49

As far as I know there are no timers that generate a IOCP completion when they expire.

You could try the Windows timer queue; CreateTimerQueueTimer.

I ended up writing my own timer queue which does use an extra thread to run the timers, so it's probably no good for you: See here for a series of articles where I implement the queue with TDD and full unit tests. I'm in the process of implementing a higher performance TimerWheel with the same interface, but again that will use an external thread to manage the timers.

You could use waitable timers and queue a custom packet to the completion port using "PostQueuedCompletionStatus". But remember that if there are multiple worker threads only one of the thread will be notified.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!