summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/IsThread.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/OSSupport/IsThread.h b/src/OSSupport/IsThread.h
index 5de5f31c4..5c8d28d2d 100644
--- a/src/OSSupport/IsThread.h
+++ b/src/OSSupport/IsThread.h
@@ -31,20 +31,20 @@ protected:
/// The overriden Execute() method should check this value periodically and terminate if this is true
volatile bool m_ShouldTerminate;
-
+
public:
cIsThread(const AString & iThreadName);
virtual ~cIsThread();
-
+
/// Starts the thread; returns without waiting for the actual start
bool Start(void);
-
+
/// Signals the thread to terminate and waits until it's finished
void Stop(void);
-
+
/// Waits for the thread to finish. Doesn't signalize the ShouldTerminate flag
bool Wait(void);
-
+
/// Returns the OS-dependent thread ID for the caller's thread
static unsigned long GetCurrentID(void);
@@ -53,7 +53,7 @@ public:
protected:
AString m_ThreadName;
-
+
// Value used for "no handle":
#ifdef _WIN32
#define NULL_HANDLE NULL
@@ -62,34 +62,34 @@ protected:
#endif
#ifdef _WIN32
-
+
DWORD m_ThreadID;
HANDLE m_Handle;
-
+
static DWORD __stdcall thrExecute(LPVOID a_Param)
{
// Create a window so that the thread can be identified by 3rd party tools:
HWND IdentificationWnd = CreateWindowA("STATIC", ((cIsThread *)a_Param)->m_ThreadName.c_str(), 0, 0, 0, 0, WS_OVERLAPPED, NULL, NULL, NULL, NULL);
-
+
// Run the thread:
((cIsThread *)a_Param)->Execute();
-
+
// Destroy the identification window:
DestroyWindow(IdentificationWnd);
-
+
return 0;
}
-
+
#else // _WIN32
-
+
pthread_t m_Handle;
-
+
static void * thrExecute(void * a_Param)
{
- ((cIsThread *)a_Param)->Execute();
+ (static_cast<cIsThread *>(a_Param))->Execute();
return NULL;
}
-
+
#endif // else _WIN32
} ;
@@ -98,7 +98,3 @@ protected:
#endif // CISTHREAD_H_INCLUDED
-
-
-
-