20 #include "objfw-defs.h" 24 #if !defined(OF_HAVE_THREADS) || \ 25 (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) 26 # error No threads available! 33 #if defined(OF_HAVE_PTHREADS) 35 typedef pthread_t OFPlainThread;
36 #elif defined(OF_WINDOWS) 38 typedef HANDLE OFPlainThread;
39 #elif defined(OF_AMIGAOS) 40 # include <exec/tasks.h> 41 # include <exec/semaphores.h> 46 struct SignalSemaphore semaphore;
47 struct Task *joinTask;
48 unsigned char joinSigBit;
56 } OFPlainThreadAttributes;
58 #if defined(OF_HAVE_PTHREADS) || defined(DOXYGEN) 64 static OF_INLINE OFPlainThread
67 return pthread_self();
79 return pthread_equal(thread, pthread_self());
81 #elif defined(OF_WINDOWS) 82 static OF_INLINE OFPlainThread
85 return GetCurrentThread();
91 return (thread == GetCurrentThread());
93 #elif defined(OF_AMIGAOS) 123 void (*
function)(
id),
id object,
const OFPlainThreadAttributes *attr);
static OF_INLINE bool OFPlainThreadIsCurrent(OFPlainThread thread)
Returns whether the specified plain thread is the current thread.
Definition: OFPlainThread.h:77
int OFPlainThreadAttributesInit(OFPlainThreadAttributes *attr)
Initializes the specified thread attributes.
int OFPlainThreadNew(OFPlainThread *thread, const char *name, void(*function)(id), id object, const OFPlainThreadAttributes *attr)
Creates a new plain thread.
void OFSetThreadName(const char *name)
Sets the name of the current thread.
int OFPlainThreadJoin(OFPlainThread thread)
Joins the specified thread.
int OFPlainThreadDetach(OFPlainThread thread)
Detaches the specified thread.
static OF_INLINE OFPlainThread OFCurrentPlainThread(void)
Returns the current plain thread.
Definition: OFPlainThread.h:65