- Made pthreads usage conditional upon HAVE_LIBPTHREAD.
This commit is contained in:
Paul Beckingham 2011-01-03 19:34:00 -05:00
parent 6a7e741b02
commit 6b18a2842f
2 changed files with 14 additions and 0 deletions

View file

@ -40,26 +40,36 @@ Thread::~Thread ()
////////////////////////////////////////////////////////////////////////////////
int Thread::start (void* inArg)
{
#ifdef HAVE_LIBPTHREAD
mArg = inArg;
return pthread_create (&mTID, NULL, (void*(*)(void*)) Thread::entryPoint, (void*) this);
#else
return 0;
#endif
}
////////////////////////////////////////////////////////////////////////////////
void Thread::wait ()
{
#ifdef HAVE_LIBPTHREAD
pthread_join (mTID, NULL);
#endif
}
////////////////////////////////////////////////////////////////////////////////
void Thread::cancel ()
{
#ifdef HAVE_LIBPTHREAD
pthread_cancel (mTID);
#endif
}
////////////////////////////////////////////////////////////////////////////////
void Thread::detach ()
{
#ifdef HAVE_LIBPTHREAD
pthread_detach (mTID);
#endif
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,7 +27,11 @@
#ifndef INCLUDED_THREAD
#define INCLUDED_THREAD
#include <../auto.h>
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
class Thread
{