Commit 1f119597 authored by Max Kellermann's avatar Max Kellermann

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.
parent 87fce8ef
...@@ -52,10 +52,8 @@ EventLoop::~EventLoop() ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment