Merge pull request #3522 from frangarcj/master
small libco fix and some silencing
This commit is contained in:
commit
77876e348b
|
@ -37,7 +37,7 @@ void co_thunk(uint32_t argOnInitialize, uint32_t argOnRun)
|
||||||
cothread_t co_active(void)
|
cothread_t co_active(void)
|
||||||
{
|
{
|
||||||
if(!co_active_)
|
if(!co_active_)
|
||||||
{
|
{
|
||||||
sceSysmoduleLoadModule(SCE_SYSMODULE_FIBER);
|
sceSysmoduleLoadModule(SCE_SYSMODULE_FIBER);
|
||||||
co_active_ = (cothread_t)1;
|
co_active_ = (cothread_t)1;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ cothread_t co_create(unsigned int heapsize, void (*coentry)(void))
|
||||||
sceSysmoduleLoadModule(SCE_SYSMODULE_FIBER);
|
sceSysmoduleLoadModule(SCE_SYSMODULE_FIBER);
|
||||||
co_active_ = (cothread_t)1;
|
co_active_ = (cothread_t)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//_sceFiberInitializeImpl
|
//_sceFiberInitializeImpl
|
||||||
int ret = _sceFiberInitializeImpl(tailFiber, "tailFiber", co_thunk, (uint32_t)coentry, (void*) m_contextBuffer, 10000, NULL);
|
int ret = _sceFiberInitializeImpl(tailFiber, "tailFiber", co_thunk, (uint32_t)coentry, (void*) m_contextBuffer, 10000, NULL);
|
||||||
if(ret==0){
|
if(ret==0){
|
||||||
|
@ -71,7 +71,7 @@ void co_delete(cothread_t cothread)
|
||||||
|
|
||||||
void co_switch(cothread_t cothread)
|
void co_switch(cothread_t cothread)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32_t argOnReturn = 0;
|
uint32_t argOnReturn = 0;
|
||||||
if(cothread == (cothread_t)1){
|
if(cothread == (cothread_t)1){
|
||||||
co_active_ = cothread;
|
co_active_ = cothread;
|
||||||
|
@ -79,11 +79,12 @@ void co_switch(cothread_t cothread)
|
||||||
}else{
|
}else{
|
||||||
SceFiber* theFiber = (SceFiber*)cothread;
|
SceFiber* theFiber = (SceFiber*)cothread;
|
||||||
if(co_active_ == (cothread_t)1){
|
if(co_active_ == (cothread_t)1){
|
||||||
|
co_active_ = cothread;
|
||||||
sceFiberRun(theFiber, 0, &argOnReturn);
|
sceFiberRun(theFiber, 0, &argOnReturn);
|
||||||
}else{
|
}else{
|
||||||
|
co_active_ = cothread;
|
||||||
sceFiberSwitch(theFiber, 0, &argOnReturn);
|
sceFiberSwitch(theFiber, 0, &argOnReturn);
|
||||||
}
|
}
|
||||||
co_active_ = cothread;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,6 @@ static INLINE int pthread_mutex_lock(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
int ret = sceKernelLockMutex(*mutex, 1, 0);
|
int ret = sceKernelLockMutex(*mutex, 1, 0);
|
||||||
//sceClibPrintf("pthread_mutex_lock: %x\n",ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -131,7 +130,6 @@ static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
int ret = sceKernelUnlockMutex(*mutex, 1);
|
int ret = sceKernelUnlockMutex(*mutex, 1);
|
||||||
//sceClibPrintf("pthread_mutex_unlock: %x\n",ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
/* FIXME: stub */
|
/* FIXME: stub */
|
||||||
|
@ -221,27 +219,25 @@ static INLINE int pthread_cond_init(pthread_cond_t *cond,
|
||||||
const pthread_condattr_t *attr)
|
const pthread_condattr_t *attr)
|
||||||
{
|
{
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
|
|
||||||
pthread_mutex_init(&cond->mutex,NULL);
|
pthread_mutex_init(&cond->mutex,NULL);
|
||||||
sceClibPrintf("pthread_cond_init: mutex %x\n",cond->mutex);
|
|
||||||
if(cond->mutex<0){
|
if(cond->mutex<0){
|
||||||
return cond->mutex;
|
return cond->mutex;
|
||||||
}
|
}
|
||||||
sprintf(name_buffer, "0x%08X", (uint32_t) cond);
|
sprintf(name_buffer, "0x%08X", (uint32_t) cond);
|
||||||
//cond->sema = sceKernelCreateCond(name_buffer, 0, cond->mutex, 0);
|
//cond->sema = sceKernelCreateCond(name_buffer, 0, cond->mutex, 0);
|
||||||
cond->sema = sceKernelCreateSema(name_buffer, 0, 0, 1, 0);
|
cond->sema = sceKernelCreateSema(name_buffer, 0, 0, 1, 0);
|
||||||
sceClibPrintf("pthread_cond_init: sema %x\n",cond->sema);
|
|
||||||
if(cond->sema<0){
|
if(cond->sema<0){
|
||||||
pthread_mutex_destroy(&cond->mutex);
|
pthread_mutex_destroy(&cond->mutex);
|
||||||
return cond->sema;
|
return cond->sema;
|
||||||
}
|
}
|
||||||
|
|
||||||
cond->waiting = 0;
|
cond->waiting = 0;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* FIXME: stub */
|
/* FIXME: stub */
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -256,7 +252,6 @@ static INLINE int pthread_cond_signal(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
--cond->waiting;
|
--cond->waiting;
|
||||||
int ret = sceKernelSignalSema(cond->sema, 1);
|
int ret = sceKernelSignalSema(cond->sema, 1);
|
||||||
sceClibPrintf("pthread_cond_signal: %x\n",ret);
|
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&cond->mutex);
|
pthread_mutex_unlock(&cond->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue