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