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:
Max Kellermann 2014-01-04 15:58:51 +01:00
parent 87fce8ef27
commit 1f1195975f

View File

@ -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