From 1f1195975f6a970d1a690ced463c184c0cf97e2d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 4 Jan 2014 15:58:51 +0100 Subject: 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. --- src/event/Loop.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index c525fc103..92492387b 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -52,10 +52,8 @@ EventLoop::~EventLoop() void EventLoop::Break() { - if (IsInside()) - quit = true; - else - AddCall([this]() { Break(); }); + quit = true; + wake_fd.Write(); } bool -- cgit v1.2.3