Commit d989dbfe authored by Max Kellermann's avatar Max Kellermann

thread/Thread: make IsInside() debug-only

This method is only used inside assert().
parent ca9fcec3
...@@ -108,8 +108,12 @@ io_thread_get() noexcept ...@@ -108,8 +108,12 @@ io_thread_get() noexcept
return *io.loop; return *io.loop;
} }
#ifndef NDEBUG
bool bool
io_thread_inside() noexcept io_thread_inside() noexcept
{ {
return io.thread.IsInside(); return io.thread.IsInside();
} }
#endif
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#ifndef MPD_IO_THREAD_HXX #ifndef MPD_IO_THREAD_HXX
#define MPD_IO_THREAD_HXX #define MPD_IO_THREAD_HXX
#include "check.h"
#include "Compiler.h" #include "Compiler.h"
class EventLoop; class EventLoop;
...@@ -53,6 +54,8 @@ gcc_const ...@@ -53,6 +54,8 @@ gcc_const
EventLoop & EventLoop &
io_thread_get() noexcept; io_thread_get() noexcept;
#ifndef NDEBUG
/** /**
* Is the current thread the I/O thread? * Is the current thread the I/O thread?
*/ */
...@@ -61,3 +64,5 @@ bool ...@@ -61,3 +64,5 @@ bool
io_thread_inside() noexcept; io_thread_inside() noexcept;
#endif #endif
#endif
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
#endif #endif
} }
#ifndef NDEBUG
/** /**
* Check if this thread is the current thread. * Check if this thread is the current thread.
*/ */
...@@ -81,6 +82,7 @@ public: ...@@ -81,6 +82,7 @@ public:
return pthread_self() == handle; return pthread_self() == handle;
#endif #endif
} }
#endif
void Start(); void Start();
void Join(); void Join();
......
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