Add Thread::stopThreadAsync

This commit is contained in:
Vinnie Falco
2013-09-30 09:28:31 -07:00
parent 4f7dca3e5a
commit a1ec423235
2 changed files with 16 additions and 0 deletions

View File

@@ -208,6 +208,17 @@ bool Thread::stopThread (const int timeOutMilliseconds)
return cleanExit; return cleanExit;
} }
void Thread::stopThreadAsync ()
{
const ScopedLock sl (startStopLock);
if (isThreadRunning())
{
signalThreadShouldExit();
notify();
}
}
//============================================================================== //==============================================================================
bool Thread::setPriority (const int newPriority) bool Thread::setPriority (const int newPriority)
{ {

View File

@@ -110,6 +110,11 @@ public:
*/ */
bool stopThread (int timeOutMilliseconds = -1); bool stopThread (int timeOutMilliseconds = -1);
/** Stop the thread without blocking.
This calls signalThreadShouldExit followed by notify.
*/
void stopThreadAsync ();
//============================================================================== //==============================================================================
/** Returns true if the thread is currently active */ /** Returns true if the thread is currently active */
bool isThreadRunning() const; bool isThreadRunning() const;