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
|
void
|
||||||
EventLoop::Break()
|
EventLoop::Break()
|
||||||
{
|
{
|
||||||
if (IsInside())
|
quit = true;
|
||||||
quit = true;
|
wake_fd.Write();
|
||||||
else
|
|
||||||
AddCall([this]() { Break(); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user