diff --git a/modules/beast_core/threads/Thread.cpp b/modules/beast_core/threads/Thread.cpp index d9d5a7ab3..6a573dd66 100644 --- a/modules/beast_core/threads/Thread.cpp +++ b/modules/beast_core/threads/Thread.cpp @@ -208,6 +208,17 @@ bool Thread::stopThread (const int timeOutMilliseconds) return cleanExit; } +void Thread::stopThreadAsync () +{ + const ScopedLock sl (startStopLock); + + if (isThreadRunning()) + { + signalThreadShouldExit(); + notify(); + } +} + //============================================================================== bool Thread::setPriority (const int newPriority) { diff --git a/modules/beast_core/threads/Thread.h b/modules/beast_core/threads/Thread.h index 8aa85024c..8cf8cf151 100644 --- a/modules/beast_core/threads/Thread.h +++ b/modules/beast_core/threads/Thread.h @@ -110,6 +110,11 @@ public: */ 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 */ bool isThreadRunning() const;