(VITA) libco: Fix small bug

This commit is contained in:
frangarcj 2016-09-06 09:26:25 +02:00
parent 5ff25ca6ae
commit 5be5ce8416
1 changed files with 5 additions and 4 deletions

View File

@ -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;
} }
} }