Differences From Artifact [2b66252a9f]:
- File src/thread.h — part of check-in [374e1a1bfa] at 2021-01-02 22:04:26 on branch trunk — Update copyright (user: js, size: 2096) [annotate] [blame] [check-ins using] [more...]
To Artifact [8049a183fa]:
- File
src/OFPlainThread.h
— part of check-in
[2fcf5a3052]
at
2021-04-29 23:24:22
on branch trunk
— Clean up struct and enum typedefs
With TYPEDEF_HIDES_STRUCT set, Doxygen properly handles anonymous
structs and enums that are typedef'd. (user: js, size: 2374) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
22 23 24 25 26 27 28 | # error No threads available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> | | | | | | > > > | > > > > > | > > > > | > > > > > | > > > > > > | < > | | | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | # error No threads available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_t OFPlainThread; #elif defined(OF_WINDOWS) # include <windows.h> typedef HANDLE OFPlainThread; #elif defined(OF_AMIGAOS) # include <exec/tasks.h> # include <exec/semaphores.h> typedef struct { struct Task *task; void (*function)(id); id object; struct SignalSemaphore semaphore; struct Task *joinTask; unsigned char joinSigBit; bool detached, done; } *OFPlainThread; #endif typedef struct { float priority; size_t stackSize; } OFPlainThreadAttributes; #if defined(OF_HAVE_PTHREADS) static OF_INLINE OFPlainThread OFCurrentPlainThread(void) { return pthread_self(); } static OF_INLINE bool OFPlainThreadIsCurrent(OFPlainThread thread) { return pthread_equal(thread, pthread_self()); } #elif defined(OF_WINDOWS) static OF_INLINE OFPlainThread OFCurrentPlainThread(void) { return GetCurrentThread(); } static OF_INLINE bool OFPlainThreadIsCurrent(OFPlainThread thread) { return (thread == GetCurrentThread()); } #elif defined(OF_AMIGAOS) extern OFPlainThread OFCurrentPlainThread(void); static OF_INLINE bool OFPlainThreadIsCurrent(OFPlainThread thread) { return (thread->thread == FindTask(NULL)); } #endif #ifdef __cplusplus extern "C" { #endif extern int OFPlainThreadAttributesInit(OFPlainThreadAttributes *attr); extern int OFPlainThreadNew(OFPlainThread *thread, const char *name, void (*function)(id), id object, const OFPlainThreadAttributes *attr); extern void OFSetThreadName(const char *name); extern int OFPlainThreadJoin(OFPlainThread thread); extern int OFPlainThreadDetach(OFPlainThread thread); #ifdef __cplusplus } #endif |