From e2a04f580a0813206f527a61244cb3382248fd12 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Dec 2014 16:59:11 +0100 Subject: BasicStyle: Added missing braces to control statements. --- src/OSSupport/Thread.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/OSSupport') diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp index faaccce96..6188d5088 100644 --- a/src/OSSupport/Thread.cpp +++ b/src/OSSupport/Thread.cpp @@ -83,12 +83,16 @@ cThread::~cThread() void cThread::Start( bool a_bWaitOnDelete /* = true */) { if (a_bWaitOnDelete) + { m_StopEvent = new cEvent(); + } #ifndef _WIN32 pthread_t SndThread; if (pthread_create( &SndThread, NULL, MyThread, this)) + { LOGERROR("ERROR: Could not create thread!"); + } #else DWORD ThreadID = 0; HANDLE hThread = CreateThread(NULL // security @@ -132,6 +136,11 @@ void *cThread::MyThread( void *a_Param) ThreadFunction( ThreadParam); - if (StopEvent) StopEvent->Set(); + // If the thread was marked as wait-on-delete, signal the event being waited on: + if (StopEvent != nullptr) + { + StopEvent->Set(); + } + return 0; } -- cgit v1.2.3