提交 ee88faf1 authored 作者: blu's avatar blu

files ring

上级 ce339c63
...@@ -912,14 +912,12 @@ public: ...@@ -912,14 +912,12 @@ public:
{ {
unique_lock<mutex> lk(this->mutEvent); unique_lock<mutex> lk(this->mutEvent);
this->cvEvent.wait(lk, [this] {return !(this->eventQueue.empty());}); this->cvEvent.wait(lk, [this] {return !(this->eventQueue.empty());});
if(!this->eventQueue.empty()) { if(!this->eventQueue.empty()) {
evt = this->eventQueue.front(); evt = this->eventQueue.front();
this->eventQueue.pop(); this->eventQueue.pop();
} }
} }
if(evt.empty()) { if(evt.empty()) {
continue; continue;
} }
...@@ -951,12 +949,12 @@ public: ...@@ -951,12 +949,12 @@ public:
spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}), resched to run in {}s.", selfId, tss, tse, first, end, this->seconds + 5); spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}), resched to run in {}s.", selfId, tss, tse, first, end, this->seconds + 5);
thread([this, evt]{ thread([this, evt]{
this_thread::sleep_for(chrono::seconds(this->seconds + 5)); this_thread::sleep_for(chrono::seconds(this->seconds + 5));
lock_guard<mutex> lock(this->mutEvent); //lock_guard<mutex> lock(this->mutEvent);
this->eventQueue.push(evt); this->eventQueue.push(evt);
if(eventQueue.size() > MAX_EVENT_QUEUE_SIZE) { if(eventQueue.size() > MAX_EVENT_QUEUE_SIZE) {
eventQueue.pop(); eventQueue.pop();
} }
cvEvent.notify_one(); //cvEvent.notify_one();
}).detach(); }).detach();
return ret; return ret;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论