fixed event loop
This commit is contained in:
parent
309ce3be30
commit
49220489ca
@ -160,6 +160,8 @@ void EventExecutor::_reassign_thread_names(std::unique_lock<std::mutex> &lock) {
|
||||
|
||||
void EventExecutor::_executor(ts::event::EventExecutor *loop) {
|
||||
while(true) {
|
||||
sassert(std::addressof(loop->lock) != nullptr);
|
||||
|
||||
unique_lock lock(loop->lock);
|
||||
loop->condition.wait(lock, [&] {
|
||||
return loop->should_shutdown || loop->should_adjust || loop->head != nullptr;
|
||||
@ -177,9 +179,11 @@ void EventExecutor::_executor(ts::event::EventExecutor *loop) {
|
||||
if(index == loop->_threads.end()) {
|
||||
/* TODO: Log error */
|
||||
} else {
|
||||
(*index).detach(); /* lets detach ourselfs before we delete the handle */
|
||||
loop->_threads.erase(index);
|
||||
}
|
||||
loop->should_adjust = ((current_threads - 1) != loop->target_threads);
|
||||
return; /* we're out now! */
|
||||
} else {
|
||||
loop->should_adjust = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user