DeleteTimerQueueTimer 函数执行成功,但回调函数却还会执行。

tp机器猫 2014-05-30 10:42:34
在IOCP中用来检查超时操作,
当所有操作正常完成,要删除这个定时器,有时候却会出现
DeleteTimerQueueTimer 函数执行成功,但回调函数却还会每隔一个定时周期执行。
...全文
519 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Eleven 2014-08-13
  • 打赏
  • 举报
回复
This function cannot be called while the thread is using impersonation. The resulting behavior is undefined. You can set CompletionEvent to INVALID_HANDLE_VALUE when calling this function from within the timer callback of another timer as long as the callback function is not executed in the timer thread. However, a deadlock may occur if two callback functions attempt a blocking DeleteTimerQueueTimer call on each others' timers. Furthermore, you cannot make a blocking deletion call on a timer associated with the callback. Be careful when making a blocking DeleteTimerQueueTimer call on a persistent thread. If the timer being deleted was created with WT_EXECUTEINPERSISTENTTHREAD, a deadlock may occur. If there are outstanding callback functions and CompletionEvent is NULL, the function will fail and set the error code to ERROR_IO_PENDING. This indicates that there are outstanding callback functions. Those callbacks either will execute or are in the middle of executing. The timer is cleaned up when the callback function is finished executing. To cancel all timers in a timer queue, call the DeleteTimerQueueEx function.
我喝多了 2014-08-13
  • 打赏
  • 举报
回复
killtimer删除定时器

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧