@@ -18,11 +18,11 @@ #include "objfw-defs.h" #include "platform.h" #if !defined(OF_HAVE_THREADS) || \ - (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS)) + (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No threads available! #endif #import "macros.h" @@ -30,23 +30,38 @@ # include typedef pthread_t of_thread_t; #elif defined(OF_WINDOWS) # include typedef HANDLE of_thread_t; +#elif defined(OF_AMIGAOS) +# include +# include +typedef struct { + struct Task *task; + void (*function)(id); + id object; + struct SignalSemaphore semaphore; + struct Task *joinTask; + uint8_t joinSigBit; + bool detached, done; +} *of_thread_t; #endif typedef struct of_thread_attr_t { float priority; size_t stackSize; } of_thread_attr_t; #if defined(OF_HAVE_PTHREADS) # define of_thread_is_current(t) pthread_equal(t, pthread_self()) -# define of_thread_current pthread_self +# define of_thread_current() pthread_self() #elif defined(OF_WINDOWS) # define of_thread_is_current(t) (t == GetCurrentThread()) -# define of_thread_current GetCurrentThread +# define of_thread_current() GetCurrentThread() +#elif defined(OF_AMIGAOS) +# define of_thread_is_current(t) (t->thread == FindTask(NULL)) +extern of_thread_t of_thread_current(void); #endif #ifdef __cplusplus extern "C" { #endif