mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
CancelSema: adjust scheduling to match PSP.
This commit is contained in:
parent
8517fbe761
commit
2e9e61dfc6
1 changed files with 9 additions and 3 deletions
|
@ -91,6 +91,12 @@ void sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr)
|
|||
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
|
||||
if (s)
|
||||
{
|
||||
if (newCount > s->ns.maxCount)
|
||||
{
|
||||
RETURN(SCE_KERNEL_ERROR_ILLEGAL_COUNT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (numWaitThreadsPtr)
|
||||
{
|
||||
u32* numWaitThreads = (u32*)Memory::GetPointer(numWaitThreadsPtr);
|
||||
|
@ -106,9 +112,9 @@ void sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr)
|
|||
// We need to set the return value BEFORE rescheduling threads.
|
||||
RETURN(0);
|
||||
|
||||
// TODO: Should this reschedule?
|
||||
if (__KernelClearSemaThreads(s, SCE_KERNEL_ERROR_WAIT_CANCEL))
|
||||
__KernelReSchedule("semaphore cancelled");
|
||||
// Cancel appears to always reschedule.
|
||||
__KernelClearSemaThreads(s, SCE_KERNEL_ERROR_WAIT_CANCEL);
|
||||
__KernelReSchedule("semaphore cancelled");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue