Commit 7372c931 authored by Max Kellermann's avatar Max Kellermann

event/Loop: make IsInsideOrNull() available in the NDEBUG build

Fixes build breakage by commit 4e5271fc; and this method does make sense in non-debug builds.
parent 29e1b6e4
...@@ -222,8 +222,9 @@ EventLoop::Run() ...@@ -222,8 +222,9 @@ EventLoop::Run()
#ifndef NDEBUG #ifndef NDEBUG
assert(busy); assert(busy);
assert(thread.IsInside()); assert(thread.IsInside());
thread = ThreadId::Null();
#endif #endif
thread = ThreadId::Null();
} }
void void
......
...@@ -212,12 +212,16 @@ public: ...@@ -212,12 +212,16 @@ public:
} }
#endif #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 gcc_pure
bool IsInsideOrNull() const { bool IsInsideOrNull() const {
return thread.IsNull() || thread.IsInside(); return thread.IsNull() || thread.IsInside();
} }
#endif
}; };
#endif /* MAIN_NOTIFY_H */ #endif /* MAIN_NOTIFY_H */
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