Commit 7272f01e by xiongziliang

确保能同步取消定时器

parent 341bb5d8
...@@ -70,10 +70,10 @@ public: ...@@ -70,10 +70,10 @@ public:
void start(int ms ,EventPoller &poller){ void start(int ms ,EventPoller &poller){
weak_ptr<TimerForC> weak_self = shared_from_this(); weak_ptr<TimerForC> weak_self = shared_from_this();
poller.doDelayTask(ms, [weak_self](){ _task = poller.doDelayTask(ms, [weak_self]() {
auto strong_self = weak_self.lock(); auto strong_self = weak_self.lock();
if(!strong_self){ if (!strong_self) {
return (uint64_t)0; return (uint64_t) 0;
} }
return (*strong_self)(); return (*strong_self)();
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论