mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 18:58:21 +00:00
(Vita) We can implement mutexes properly for Vita
This commit is contained in:
parent
e57202ff90
commit
d80b24f380
@ -24,9 +24,13 @@
|
||||
#ifndef _PSP_PTHREAD_WRAP__
|
||||
#define _PSP_PTHREAD_WRAP__
|
||||
|
||||
#ifdef VITA
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
#else
|
||||
#include <pspkernel.h>
|
||||
#include <pspthreadman.h>
|
||||
#include <pspthreadman_kernel.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
@ -78,24 +82,40 @@ static INLINE int pthread_mutex_init(pthread_mutex_t *mutex,
|
||||
{
|
||||
sprintf(name_buffer, "0x%08X", (uint32_t) mutex);
|
||||
|
||||
#ifdef VITA
|
||||
return *mutex = sceKernelCreateMutex(name_buffer, 0, 0, 0);
|
||||
#else
|
||||
return *mutex = sceKernelCreateSema(name_buffer, 0, 1, 1, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||
{
|
||||
#ifdef VITA
|
||||
return sceKernelDeleteMutex(*mutex);
|
||||
#else
|
||||
return sceKernelDeleteSema(*mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE int pthread_mutex_lock(pthread_mutex_t *mutex)
|
||||
{
|
||||
//FIXME: stub
|
||||
#ifdef VITA
|
||||
return sceKernelLockMutex(*mutex, 1, 0);
|
||||
#else
|
||||
/* FIXME: stub */
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
||||
{
|
||||
//FIXME: stub
|
||||
#ifdef VITA
|
||||
return sceKernelUnlockMutex(*mutex, 1);
|
||||
#else
|
||||
/* FIXME: stub */
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user