24 #ifndef _PSP_PTHREAD_WRAP__ 25 #define _PSP_PTHREAD_WRAP__ 28 #include <psp2/kernel/threadmgr.h> 31 #include <pspkernel.h> 32 #include <pspthreadman.h> 33 #include <pspthreadman_kernel.h> 38 #define STACKSIZE (8 * 1024) 57 typedef void* (*sthreadEntry)(
void *argp);
74 const pthread_attr_t *attr,
void *(*start_routine)(
void*),
void *arg)
80 0x10000100, 0x10000, 0, 0,
NULL);
87 sthread_args.
arg = arg;
90 return sceKernelStartThread(*thread,
sizeof(sthread_args), &sthread_args);
111 return sceKernelDeleteMutex(*
mutex);
113 return sceKernelDeleteSema(*
mutex);
120 int ret = sceKernelLockMutex(*
mutex, 1, 0);
132 int ret = sceKernelUnlockMutex(*
mutex, 1);
144 int res = sceKernelWaitThreadEnd(thread, 0, 0);
147 return sceKernelDeleteThread(thread);
150 sceKernelWaitThreadEnd(thread, &
timeout);
151 exit_status = sceKernelGetThreadExitStatus(thread);
152 sceKernelDeleteThread(thread);
160 return sceKernelTryLockMutex(*
mutex, 1 );
178 ret = sceKernelWaitSema(
cond->sema, 1, 0);
180 sceClibPrintf(
"Premature wakeup: %08X", ret);
185 sceKernelDelayThread(10000);
204 timeout += abstime->tv_nsec / 1.0e6;
208 sceClibPrintf(
"Premature wakeup: %08X", ret);
255 sceKernelSignalSema(
cond->sema, 1);
274 int ret = sceKernelDeleteSema(
cond->sema);
278 return sceKernelDeleteMutex(
cond->mutex);
294 sceKernelExitDeleteThread(sceKernelGetThreadId());
301 return sceKernelGetThreadId();
309 #endif //_PSP_PTHREAD_WRAP__ static INLINE int pthread_detach(pthread_t thread)
Definition: psp_pthread.h:286
static INLINE int pthread_equal(pthread_t t1, pthread_t t2)
Definition: psp_pthread.h:304
GLbitfield GLuint64 timeout
Definition: glext.h:7831
static INLINE int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
Definition: psp_pthread.h:190
static INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: psp_pthread.h:108
#define INLINE
Definition: retro_inline.h:35
static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
Definition: psp_pthread.h:129
static INLINE int pthread_cond_signal(pthread_cond_t *cond)
Definition: psp_pthread.h:248
static INLINE int pthread_join(pthread_t thread, void **retval)
Definition: psp_pthread.h:141
SceUID pthread_t
Definition: psp_pthread.h:40
GLuint res
Definition: glext.h:10520
struct pthread_cond_t_ * pthread_cond_t
Definition: pthread.h:404
static INLINE int pthread_mutex_lock(pthread_mutex_t *mutex)
Definition: psp_pthread.h:117
SceUID sema
Definition: psp_pthread.h:48
static int cond(LexState *ls)
Definition: lparser.c:1177
int waiting
Definition: psp_pthread.h:49
void * arg
Definition: psp_pthread.h:61
static sys_sem mutex
Definition: memp.c:120
static INLINE int pthread_cond_destroy(pthread_cond_t *cond)
Definition: psp_pthread.h:271
static INLINE int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: psp_pthread.h:73
SceUID pthread_condattr_t
Definition: psp_pthread.h:52
Definition: psp_pthread.h:59
static int psp_thread_wrap(SceSize args, void *argp)
Definition: psp_pthread.h:66
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static INLINE int pthread_mutex_trylock(pthread_mutex_t *mutex)
Definition: psp_pthread.h:157
SceUID pthread_mutex_t
Definition: psp_pthread.h:41
Definition: implement.h:146
unsigned int SceUInt
Definition: pte_types.h:31
Definition: psp_pthread.h:45
static INLINE pthread_t pthread_self(void)
Definition: psp_pthread.h:298
#define STACKSIZE
Definition: psp_pthread.h:38
unsigned int SceSize
Definition: pte_types.h:27
static INLINE int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: psp_pthread.h:93
void * pthread_t
Definition: pthread.h:398
static INLINE int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Definition: psp_pthread.h:218
dictionary args
Definition: test_shaders.py:20
SceUID mutex
Definition: psp_pthread.h:47
static INLINE int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: psp_pthread.h:167
void *(* sthreadEntry)(void *argp)
Definition: psp_pthread.h:57
int SceUID
Definition: pte_types.h:24
int pthread_attr_t
Definition: psp_pthread.h:43
char name_buffer[256]
Definition: psp_pthread.h:55
static INLINE int pthread_cond_broadcast(pthread_cond_t *cond)
Definition: psp_pthread.h:265
Definition: implement.h:163
sthreadEntry start_routine
Definition: psp_pthread.h:62
Definition: implement.h:116
Definition: implement.h:251
void * pthread_mutexattr_t
Definition: psp_pthread.h:42
static INLINE void pthread_exit(void *retval)
Definition: psp_pthread.h:291