aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/Loop.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-04 15:58:51 +0100
committerMax Kellermann <max@duempel.org>2014-01-04 15:59:00 +0100
commit1f1195975f6a970d1a690ced463c184c0cf97e2d (patch)
tree505ad10059a166b250f96e2bc658e8921e4d6acf /src/event/Loop.cxx
parent87fce8ef27dd86d492cb3072a3b3a5a756607b1e (diff)
downloadmpd-1f1195975f6a970d1a690ced463c184c0cf97e2d.tar.gz
mpd-1f1195975f6a970d1a690ced463c184c0cf97e2d.tar.xz
mpd-1f1195975f6a970d1a690ced463c184c0cf97e2d.zip
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.
Diffstat (limited to '')
-rw-r--r--src/event/Loop.cxx6
1 files changed, 2 insertions, 4 deletions
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