public int sceKernelPollSema(CpuThreadState CpuThreadState, SemaphoreId SemaphoreId, int Signal)
{
var Semaphore = GetSemaphoreById(SemaphoreId);
if (Signal <= 0) throw(new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_COUNT));
if (Signal > Semaphore.CurrentCount)
{
//ThreadManager.Reschedule();
//CpuThreadState.Yield();
throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_SEMA_ZERO));
//return 0;
}
Semaphore.IncrementCount(-Signal);
//throw(new NotImplementedException());
return 0;
/*
try {
PspSemaphore pspSemaphore = uniqueIdFactory.get!PspSemaphore(semaid);
if (pspSemaphore.info.currentCount - signal < 0) return SceKernelErrors.ERROR_KERNEL_SEMA_ZERO;
pspSemaphore.info.currentCount -= signal;
return 0;
} catch (UniqueIdNotFoundException) {
return SceKernelErrors.ERROR_KERNEL_NOT_FOUND_SEMAPHORE;
}
*/
}