}
typedef pthread_t thread_t;
+ #define INVALID_THREAD_VALUE 0
#define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
#define ThreadsWait(thread, retval) (thread ? pthread_join(thread, retval) == 0 : true)
m_bStop(false),
m_bRunning(false),
m_bStopped(false),
- m_thread(NULL) {}
+ m_thread(INVALID_THREAD_VALUE) {}
virtual ~CThread(void)
{
StopThread(0);
void *retVal = NULL;
- if (m_thread)
+ if (m_thread != INVALID_THREAD_VALUE)
ThreadsWait(m_thread, &retVal);
}
namespace PLATFORM
{
#define thread_t HANDLE
+ #define INVALID_THREAD_VALUE INVALID_HANDLE
#define ThreadsWait(thread, retVal) (::WaitForSingleObject(thread, INFINITE) < 0)
#define ThreadsCreate(thread, func, arg) ((thread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, NULL)) == NULL ? false : true)