diff options
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/IsThread.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/OSSupport/IsThread.h b/src/OSSupport/IsThread.h index f642c8724..fa6813cd7 100644 --- a/src/OSSupport/IsThread.h +++ b/src/OSSupport/IsThread.h @@ -32,10 +32,6 @@ protected: /** The overriden Execute() method should check this value periodically and terminate if this is true. */ volatile bool m_ShouldTerminate; -private: - /** Wrapper for Execute() that waits for the initialization event, to prevent race conditions in thread initialization. */ - void DoExecute(void); - public: cIsThread(const AString & a_ThreadName); virtual ~cIsThread(); @@ -51,14 +47,21 @@ public: /** Returns true if the thread calling this function is the thread contained within this object. */ bool IsCurrentThread(void) const { return std::this_thread::get_id() == m_Thread.get_id(); } + +private: -protected: + /** The name of the thread, used to aid debugging in IDEs which support named threads */ AString m_ThreadName; + + /** The thread object which holds the created thread for later manipulation */ std::thread m_Thread; /** The event that is used to wait with the thread's execution until the thread object is fully initialized. - This prevents the IsCurrentThread() call to fail because of a race-condition. */ + This prevents the IsCurrentThread() call to fail because of a race-condition where the thread starts before m_Thread has been fully assigned. */ cEvent m_evtStart; + + /** Wrapper for Execute() that waits for the initialization event, to prevent race conditions in thread initialization. */ + void DoExecute(void); } ; |