23 #ifndef _GX_PTHREAD_WRAP_GX_ 24 #define _GX_PTHREAD_WRAP_GX_ 32 #define OSThread lwp_t 40 #define OSThreadQueue lwpq_t 44 #define OSInitMutex(mutex) LWP_MutexInit(mutex, 0) 48 #define OSLockMutex(mutex) LWP_MutexLock(mutex) 52 #define OSUnlockMutex(mutex) LWP_MutexUnlock(mutex) 55 #ifndef OSTryLockMutex 56 #define OSTryLockMutex(mutex) LWP_MutexTryLock(mutex) 60 #define OSInitCond(cond) LWP_CondInit(cond) 64 #define OSWaitCond(cond, mutex) LWP_CondWait(cond, mutex) 67 #ifndef OSInitThreadQueue 68 #define OSInitThreadQueue(queue) LWP_InitQueue(queue) 72 #define OSSleepThread(queue) LWP_ThreadSleep(queue) 76 #define OSJoinThread(thread, val) LWP_JoinThread(thread, val) 79 #ifndef OSCreateThread 80 #define OSCreateThread(thread, func, intarg, ptrarg, stackbase, stacksize, priority, attrs) LWP_CreateThread(thread, func, ptrarg, stackbase, stacksize, priority) 83 #define STACKSIZE (8 * 1024) 93 const pthread_attr_t *attr,
void *(*start_routine)(
void*),
void *arg)
int pthread_attr_t
Definition: gx_pthread.h:88
int mutex_t
typedef for the mutex handle
Definition: lock.c:6
#define INLINE
Definition: retro_inline.h:35
void * pthread_mutexattr_t
Definition: gx_pthread.h:87
s32 LWP_MutexDestroy(mutex_t mutex)
Close mutex lock, release all threads and handles locked on this mutex.
Definition: mutex.c:122
mutex_t pthread_mutex_t
Definition: gx_pthread.h:86
static INLINE void pthread_exit(void *retval)
Definition: gx_pthread.h:127
static int cond(LexState *ls)
Definition: lparser.c:1177
OSCond pthread_cond_t
Definition: gx_pthread.h:89
#define OSCond
Definition: gx_pthread.h:36
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
static sys_sem mutex
Definition: memp.c:120
Core header which includes all subsequent subsystem headers.
lwp_t LWP_GetSelf()
Return the handle to the current thread.
Definition: lwp.c:252
#define OSTryLockMutex(mutex)
Definition: gx_pthread.h:56
s32 LWP_CondDestroy(cond_t cond)
Destroy condition variable, release all threads and handles blocked on that condition variable.
Definition: cond.c:186
#define OSJoinThread(thread, val)
Definition: gx_pthread.h:76
s32 LWP_CondSignal(cond_t cond)
Signal a specific thread waiting on this condition variable to wake up.
Definition: cond.c:167
#define OSInitCond(cond)
Definition: gx_pthread.h:60
OSCond pthread_condattr_t
Definition: gx_pthread.h:90
Definition: implement.h:146
Definition: psp_pthread.h:45
static INLINE pthread_t pthread_self(void)
Definition: gx_pthread.h:100
static INLINE int pthread_mutex_lock(pthread_mutex_t *mutex)
Definition: gx_pthread.h:117
static INLINE int pthread_mutex_trylock(pthread_mutex_t *mutex)
Definition: gx_pthread.h:145
static INLINE int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
Definition: gx_pthread.h:156
#define OSLockMutex(mutex)
Definition: gx_pthread.h:48
void * pthread_t
Definition: pthread.h:398
static INLINE int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: gx_pthread.h:92
static INLINE int pthread_cond_signal(pthread_cond_t *cond)
Definition: gx_pthread.h:168
static INLINE int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: gx_pthread.h:150
s32 LWP_CondBroadcast(cond_t cond)
Broadcast all threads waiting on this condition variable to wake up.
Definition: cond.c:172
static INLINE int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: gx_pthread.h:106
#define OSWaitCond(cond, mutex)
Definition: gx_pthread.h:64
OSThread pthread_t
Definition: gx_pthread.h:85
static INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: gx_pthread.h:112
static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
Definition: gx_pthread.h:122
#define OSUnlockMutex(mutex)
Definition: gx_pthread.h:52
#define OSInitMutex(mutex)
Definition: gx_pthread.h:44
static INLINE int pthread_cond_broadcast(pthread_cond_t *cond)
Definition: gx_pthread.h:173
#define OSCreateThread(thread, func, intarg, ptrarg, stackbase, stacksize, priority, attrs)
Definition: gx_pthread.h:80
Definition: implement.h:163
Definition: implement.h:116
int pthread_equal(pthread_t t1, pthread_t t2)
Definition: pthread.c:615
#define STACKSIZE
Definition: gx_pthread.h:83
s32 LWP_CondTimedWait(cond_t cond, mutex_t mutex, const struct timespec *abstime)
Timed wait on a conditionvariable.
Definition: cond.c:177
static INLINE int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Definition: gx_pthread.h:162
Definition: implement.h:251
static INLINE int pthread_join(pthread_t thread, void **retval)
Definition: gx_pthread.h:140
static INLINE int pthread_detach(pthread_t thread)
Definition: gx_pthread.h:133
static INLINE int pthread_cond_destroy(pthread_cond_t *cond)
Definition: gx_pthread.h:178