Generate a fatal error if a running Thread object is destroyed

This commit is contained in:
Vinnie Falco
2013-08-02 08:31:07 -07:00
parent 03baeccda5
commit 66b96b90d5
3 changed files with 3 additions and 7 deletions

View File

@@ -4,8 +4,6 @@ BEAST TODO
- add expectThrow() to UnitTest, where it expects an exception
- Remove timeout forced-kill from Thread::stopThread ()
- Import secp256k1 from sipa
- HashMap work:

View File

@@ -42,7 +42,8 @@ Thread::~Thread()
*/
bassert (! isThreadRunning());
stopThread (100);
if (isThreadRunning())
FatalError ("Thread is still running", __FILE__, __LINE__);
}
//==============================================================================

View File

@@ -56,10 +56,7 @@ public:
/** Destructor.
Deleting a Thread object that is running will only give the thread a
brief opportunity to stop itself cleanly, so it's recommended that you
should always call stopThread() with a decent timeout before deleting,
to avoid the thread being forcibly killed (which is a Bad Thing).
If the thread has not been stopped first, this will generate a fatal error.
*/
virtual ~Thread();