mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
Merge pull request #217 from edisenwangK/fixbug_tc_timer_memory_leak
修复在重复定时处理函数中,删除定时任务时_tmeEvent造成得内存泄露
This commit is contained in:
commit
c8f541fcce
@ -195,6 +195,11 @@ protected:
|
||||
shared_ptr<Func> p = wPtr.lock();
|
||||
if(p)
|
||||
{
|
||||
{
|
||||
std::unique_lock <std::mutex> lock(_mutex);
|
||||
_tmpEvent.erase(p->_uniqueId);
|
||||
}
|
||||
|
||||
if (this->exist(p->_uniqueId, true))
|
||||
{
|
||||
if (p->_cron.isset)
|
||||
@ -208,8 +213,6 @@ protected:
|
||||
p->_fireMillseconds = TC_TimeProvider::getInstance()->getNowMs() + repeatTime;
|
||||
this->post(p);
|
||||
}
|
||||
|
||||
_tmpEvent.erase(p->_uniqueId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user