From 8f4b4c55b26ffb66463cb3bad29b87d510930098 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 30 Aug 2015 20:06:51 +0200 Subject: [PATCH] (Vita) Add naive implementation for pthread_mutex_trylock --- libretro-common/rthreads/psp_pthread.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libretro-common/rthreads/psp_pthread.h b/libretro-common/rthreads/psp_pthread.h index 7f44cf5cb5..9d3032f806 100644 --- a/libretro-common/rthreads/psp_pthread.h +++ b/libretro-common/rthreads/psp_pthread.h @@ -121,17 +121,23 @@ static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex) static INLINE int pthread_join(pthread_t thread, void **retval) { + int exit_status; SceUInt timeout = (SceUInt)-1; + sceKernelWaitThreadEnd(thread, &timeout); - int exit_status = sceKernelGetThreadExitStatus(thread); + exit_status = sceKernelGetThreadExitStatus(thread); sceKernelDeleteThread(thread); return exit_status; } static INLINE int pthread_mutex_trylock(pthread_mutex_t *mutex) { - //FIXME: stub +#ifdef VITA + return sceKernelTryLockMutex(*mutex, 1 /* not sure about this last param */); +#else + /* FIXME: stub */ return 1; +#endif } static INLINE int pthread_cond_wait(pthread_cond_t *cond,