mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 09:13:39 +01:00
CancelSema: adjust scheduling to match PSP.
This commit is contained in:
1 parent
8517fbe761
commit
2e9e61dfc6
1 file changed
+9
-3
@@ -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
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user