event/Loop: non-recursive Break() implementation
Simply set the "quit" flag and wake up the thread. This works even if we're inside this thread. Setting "quit" to a new value without mutex protection is usually not safe, but good enough here.
This commit is contained in:
parent
87fce8ef27
commit
1f1195975f
@ -52,10 +52,8 @@ EventLoop::~EventLoop()
|
||||
void
|
||||
EventLoop::Break()
|
||||
{
|
||||
if (IsInside())
|
||||
quit = true;
|
||||
else
|
||||
AddCall([this]() { Break(); });
|
||||
quit = true;
|
||||
wake_fd.Write();
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user