mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Build
- Made pthreads usage conditional upon HAVE_LIBPTHREAD.
This commit is contained in:
parent
6a7e741b02
commit
6b18a2842f
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -27,7 +27,11 @@
|
|||
#ifndef INCLUDED_THREAD
|
||||
#define INCLUDED_THREAD
|
||||
|
||||
#include <../auto.h>
|
||||
|
||||
#ifdef HAVE_LIBPTHREAD
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
class Thread
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue