diff --git a/Makefile.griffin b/Makefile.griffin index 85b6f92dcf..a37c55511e 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -378,6 +378,9 @@ CFLAGS += -DHAVE_THREADS ifeq ($(platform), psp1) LIBS += -lpthread-psp endif +ifeq ($(platform), vita) +LIBS += -lpthread +endif endif ifeq ($(HAVE_RSOUND), 1) diff --git a/libretro-common/rthreads/psp_pthread.h b/libretro-common/rthreads/psp_pthread.h index e08e86b6b7..e1afdc5f78 100644 --- a/libretro-common/rthreads/psp_pthread.h +++ b/libretro-common/rthreads/psp_pthread.h @@ -73,7 +73,7 @@ static int psp_thread_wrap(SceSize args, void *argp) static INLINE int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) { - sprintf(name_buffer, "0x%08X", (uint32_t) thread); + sprintf(name_buffer, "0x%08X", (unsigned int) thread); #ifdef VITA *thread = sceKernelCreateThread(name_buffer, psp_thread_wrap, @@ -93,7 +93,7 @@ static INLINE int pthread_create(pthread_t *thread, static INLINE int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) { - sprintf(name_buffer, "0x%08X", (uint32_t) mutex); + sprintf(name_buffer, "0x%08X", (unsigned int) mutex); #ifdef VITA *mutex = sceKernelCreateMutex(name_buffer, 0, 0, 0); @@ -224,7 +224,7 @@ static INLINE int pthread_cond_init(pthread_cond_t *cond, if(cond->mutex<0){ return cond->mutex; } - sprintf(name_buffer, "0x%08X", (uint32_t) cond); + sprintf(name_buffer, "0x%08X", (unsigned int) cond); //cond->sema = sceKernelCreateCond(name_buffer, 0, cond->mutex, 0); cond->sema = sceKernelCreateSema(name_buffer, 0, 0, 1, 0); if(cond->sema<0){ @@ -251,7 +251,7 @@ static INLINE int pthread_cond_signal(pthread_cond_t *cond) if (cond->waiting) { --cond->waiting; - int ret = sceKernelSignalSema(cond->sema, 1); + sceKernelSignalSema(cond->sema, 1); } pthread_mutex_unlock(&cond->mutex); return 0; diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 5966005754..6f887c7424 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -41,7 +41,7 @@ #endif #elif defined(GEKKO) #include "gx_pthread.h" -#elif defined(PSP) || defined(VITA) +#elif defined(PSP) #include "psp_pthread.h" #elif defined(__CELLOS_LV2__) #include @@ -154,11 +154,11 @@ error: /** * sthread_detach: - * @thread : pointer to thread object + * @thread : pointer to thread object * * Detach a thread. When a detached thread terminates, its * resource sare automatically released back to the system - * without the need for another thread to join with the + * without the need for another thread to join with the * terminated thread. * * Returns: 0 on success, otherwise it returns a non-zero error number. @@ -176,13 +176,13 @@ int sthread_detach(sthread_t *thread) /** * sthread_join: - * @thread : pointer to thread object + * @thread : pointer to thread object * * Join with a terminated thread. Waits for the thread specified by * @thread to terminate. If that thread has already terminated, then * it will return immediately. The thread specified by @thread must * be joinable. - * + * * Returns: 0 on success, otherwise it returns a non-zero error number. */ void sthread_join(sthread_t *thread) @@ -198,13 +198,13 @@ void sthread_join(sthread_t *thread) /** * sthread_isself: - * @thread : pointer to thread object + * @thread : pointer to thread object * * Join with a terminated thread. Waits for the thread specified by * @thread to terminate. If that thread has already terminated, then * it will return immediately. The thread specified by @thread must * be joinable. - * + * * Returns: true (1) if calling thread is the specified thread */ bool sthread_isself(sthread_t *thread) @@ -248,7 +248,7 @@ error: /** * slock_free: - * @lock : pointer to mutex object + * @lock : pointer to mutex object * * Frees a mutex. **/ @@ -267,7 +267,7 @@ void slock_free(slock_t *lock) /** * slock_lock: - * @lock : pointer to mutex object + * @lock : pointer to mutex object * * Locks a mutex. If a mutex is already locked by * another thread, the calling thread shall block until @@ -284,7 +284,7 @@ void slock_lock(slock_t *lock) /** * slock_unlock: - * @lock : pointer to mutex object + * @lock : pointer to mutex object * * Unlocks a mutex. **/ @@ -333,7 +333,7 @@ error: /** * scond_free: - * @cond : pointer to condition variable object + * @cond : pointer to condition variable object * * Frees a condition variable. **/ @@ -352,16 +352,16 @@ void scond_free(scond_t *cond) /** * scond_wait: - * @cond : pointer to condition variable object - * @lock : pointer to mutex object + * @cond : pointer to condition variable object + * @lock : pointer to mutex object * - * Block on a condition variable (i.e. wait on a condition). + * Block on a condition variable (i.e. wait on a condition). **/ void scond_wait(scond_t *cond, slock_t *lock) { #ifdef USE_WIN32_THREADS WaitForSingleObject(cond->event, 0); - + SignalObjectAndWait(lock->lock, cond->event, INFINITE, FALSE); slock_lock(lock); #else @@ -371,15 +371,15 @@ void scond_wait(scond_t *cond, slock_t *lock) /** * scond_broadcast: - * @cond : pointer to condition variable object + * @cond : pointer to condition variable object * * Broadcast a condition. Unblocks all threads currently blocked - * on the specified condition variable @cond. + * on the specified condition variable @cond. **/ int scond_broadcast(scond_t *cond) { #ifdef USE_WIN32_THREADS - /* FIXME _- check how this function should differ + /* FIXME _- check how this function should differ * from scond_signal implementation. */ SetEvent(cond->event); return 0; @@ -390,10 +390,10 @@ int scond_broadcast(scond_t *cond) /** * scond_signal: - * @cond : pointer to condition variable object + * @cond : pointer to condition variable object * * Signal a condition. Unblocks at least one of the threads currently blocked - * on the specified condition variable @cond. + * on the specified condition variable @cond. **/ void scond_signal(scond_t *cond) { @@ -406,8 +406,8 @@ void scond_signal(scond_t *cond) /** * scond_wait_timeout: - * @cond : pointer to condition variable object - * @lock : pointer to mutex object + * @cond : pointer to condition variable object + * @lock : pointer to mutex object * @timeout_us : timeout (in microseconds) * * Try to block on a condition variable (i.e. wait on a condition) until