Fix for NULL arithmetic compiler warning in Linux.
This commit is contained in:
parent
a8cf6edab0
commit
99da44095a
@ -53,7 +53,7 @@ static void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName)
|
|||||||
cIsThread::cIsThread(const AString & iThreadName) :
|
cIsThread::cIsThread(const AString & iThreadName) :
|
||||||
m_ThreadName(iThreadName),
|
m_ThreadName(iThreadName),
|
||||||
m_ShouldTerminate(false),
|
m_ShouldTerminate(false),
|
||||||
m_Handle(NULL)
|
m_Handle(NULL_HANDLE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +73,7 @@ cIsThread::~cIsThread()
|
|||||||
|
|
||||||
bool cIsThread::Start(void)
|
bool cIsThread::Start(void)
|
||||||
{
|
{
|
||||||
ASSERT(m_Handle == NULL); // Has already started one thread?
|
ASSERT(m_Handle == NULL_HANDLE); // Has already started one thread?
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Create the thread suspended, so that the mHandle variable is valid in the thread procedure
|
// Create the thread suspended, so that the mHandle variable is valid in the thread procedure
|
||||||
DWORD ThreadID = 0;
|
DWORD ThreadID = 0;
|
||||||
@ -111,7 +110,7 @@ bool cIsThread::Start(void)
|
|||||||
|
|
||||||
void cIsThread::Stop(void)
|
void cIsThread::Stop(void)
|
||||||
{
|
{
|
||||||
if (m_Handle == NULL)
|
if (m_Handle == NULL_HANDLE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,28 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
AString m_ThreadName;
|
AString m_ThreadName;
|
||||||
|
|
||||||
|
// Value used for "no handle":
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define NULL_HANDLE NULL
|
||||||
|
#else
|
||||||
|
#define NULL_HANDLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
HANDLE m_Handle;
|
HANDLE m_Handle;
|
||||||
|
|
||||||
static DWORD_PTR __stdcall thrExecute(LPVOID a_Param)
|
static DWORD_PTR __stdcall thrExecute(LPVOID a_Param)
|
||||||
{
|
{
|
||||||
|
// Create a window so that the thread can be identified by 3rd party tools:
|
||||||
HWND IdentificationWnd = CreateWindow("STATIC", ((cIsThread *)a_Param)->m_ThreadName.c_str(), 0, 0, 0, 0, WS_OVERLAPPED, NULL, NULL, NULL, NULL);
|
HWND IdentificationWnd = CreateWindow("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();
|
((cIsThread *)a_Param)->Execute();
|
||||||
|
|
||||||
|
// Destroy the identification window:
|
||||||
DestroyWindow(IdentificationWnd);
|
DestroyWindow(IdentificationWnd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user