From 7372c931b3d1cbf4237b37750aa76602fc0382e7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Feb 2017 21:21:49 +0100 Subject: [PATCH] event/Loop: make IsInsideOrNull() available in the NDEBUG build Fixes build breakage by commit 4e5271fcdf7; and this method does make sense in non-debug builds. --- src/event/Loop.cxx | 3 ++- src/event/Loop.hxx | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 3420676a1..ada820c2d 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -222,8 +222,9 @@ EventLoop::Run() #ifndef NDEBUG assert(busy); assert(thread.IsInside()); - thread = ThreadId::Null(); #endif + + thread = ThreadId::Null(); } void diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index 7c0e0b028..f1962b4df 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -212,12 +212,16 @@ public: } #endif -#ifndef NDEBUG + /** + * Like IsInside(), but also returns true if the thread has + * already ended (or was not started yet). This is useful for + * code which may run during startup or shutdown, when events + * are not yet/anymore handled. + */ gcc_pure bool IsInsideOrNull() const { return thread.IsNull() || thread.IsInside(); } -#endif }; #endif /* MAIN_NOTIFY_H */