(psp_pthread.h) Cleanup
This commit is contained in:
parent
ff0d9326f9
commit
aed2dfe630
|
@ -142,12 +142,10 @@ static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
|||
|
||||
static INLINE int pthread_join(pthread_t thread, void **retval)
|
||||
{
|
||||
|
||||
#ifdef VITA
|
||||
int res = sceKernelWaitThreadEnd(thread, 0, 0);
|
||||
if (res < 0) {
|
||||
if (res < 0)
|
||||
return res;
|
||||
}
|
||||
return sceKernelDeleteThread(thread);
|
||||
#else
|
||||
SceUInt timeout = (SceUInt)-1;
|
||||
|
@ -173,17 +171,15 @@ static INLINE int pthread_cond_wait(pthread_cond_t *cond,
|
|||
{
|
||||
#ifdef VITA
|
||||
int ret = pthread_mutex_lock(&cond->mutex);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
++cond->waiting;
|
||||
pthread_mutex_unlock(mutex);
|
||||
pthread_mutex_unlock(&cond->mutex);
|
||||
|
||||
ret = sceKernelWaitSema(cond->sema, 1, 0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
sceClibPrintf("Premature wakeup: %08X", ret);
|
||||
}
|
||||
pthread_mutex_lock(mutex);
|
||||
return ret;
|
||||
#else
|
||||
|
@ -198,9 +194,8 @@ static INLINE int pthread_cond_timedwait(pthread_cond_t *cond,
|
|||
{
|
||||
#ifdef VITA
|
||||
int ret = pthread_mutex_lock(&cond->mutex);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
++cond->waiting;
|
||||
pthread_mutex_unlock(mutex);
|
||||
pthread_mutex_unlock(&cond->mutex);
|
||||
|
@ -211,9 +206,8 @@ static INLINE int pthread_cond_timedwait(pthread_cond_t *cond,
|
|||
timeout += abstime->tv_nsec / 1.0e6;
|
||||
|
||||
ret = sceKernelWaitSema(cond->sema, 1, &timeout);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
sceClibPrintf("Premature wakeup: %08X", ret);
|
||||
}
|
||||
pthread_mutex_lock(mutex);
|
||||
return ret;
|
||||
|
||||
|
@ -258,7 +252,8 @@ static INLINE int pthread_cond_signal(pthread_cond_t *cond)
|
|||
{
|
||||
#ifdef VITA
|
||||
pthread_mutex_lock(&cond->mutex);
|
||||
if (cond->waiting) {
|
||||
if (cond->waiting)
|
||||
{
|
||||
--cond->waiting;
|
||||
int ret = sceKernelSignalSema(cond->sema, 1);
|
||||
sceClibPrintf("pthread_cond_signal: %x\n",ret);
|
||||
|
|
Loading…
Reference in New Issue