summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cThread.cpp24
-rw-r--r--source/cThread.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/source/cThread.cpp b/source/cThread.cpp
index f07a973b5..3df75f0e7 100644
--- a/source/cThread.cpp
+++ b/source/cThread.cpp
@@ -45,15 +45,17 @@ cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_Thre
, m_Param( a_Param )
, m_Event( new cEvent() )
, m_StopEvent( 0 )
- , m_ThreadName( 0 )
{
if( a_ThreadName )
{
- m_ThreadName = new char[ strlen(a_ThreadName)+1 ];
- strcpy(m_ThreadName, a_ThreadName);
+ m_ThreadName.assign(a_ThreadName);
}
}
+
+
+
+
cThread::~cThread()
{
delete m_Event;
@@ -63,10 +65,12 @@ cThread::~cThread()
m_StopEvent->Wait();
delete m_StopEvent;
}
-
- delete [] m_ThreadName;
}
+
+
+
+
void cThread::Start( bool a_bWaitOnDelete /* = true */ )
{
if( a_bWaitOnDelete )
@@ -86,16 +90,22 @@ void cThread::Start( bool a_bWaitOnDelete /* = true */ )
,&ThreadID ); // thread id
CloseHandle( hThread );
- if( m_ThreadName )
+ #ifdef _MSC_VER
+ if (!m_ThreadName.empty())
{
- SetThreadName(ThreadID, m_ThreadName );
+ SetThreadName(ThreadID, m_ThreadName.c_str());
}
+ #endif // _MSC_VER
#endif
// Wait until thread has actually been created
m_Event->Wait();
}
+
+
+
+
#ifdef _WIN32
unsigned long cThread::MyThread(void* a_Param )
#else
diff --git a/source/cThread.h b/source/cThread.h
index 5707e4bac..3c9316424 100644
--- a/source/cThread.h
+++ b/source/cThread.h
@@ -22,5 +22,5 @@ private:
cEvent* m_Event;
cEvent* m_StopEvent;
- char* m_ThreadName;
+ AString m_ThreadName;
}; \ No newline at end of file