hrydgard/ppsspp — pull request #3583 by unknownbrackets (2013-09-03 03:00:22+00:00)
Title: Callback and minor scheduling fixes

I'm ripping out the entire pendingMipsCalls and registeredCallbacks and etc. because it's all over complicated. Unfortunately, the suspend wait/resume wait funcs seem to be needed.

I figured a good first step was to add those to more wait types. The practical impact is that we no longer have to "inject" the result of a wait that is e.g. acquited during the callback. It also makes it recheck the wait after the callback (for example, a callback can perfectly legitimately delete the thing that was being waited on.)

However, I'm not done yet. There's more left:
* MsgPipes: annoying, because there's send and receive lists.
* ThreadEnd: probably gonna redo it with a waitingThreads list.
* UMD: haven't worried about it yet.
* Vblank: need to test if a multi5 + callback that lasts 5 vblanks means wake immed. or after another 5.
* IO: after starting, I realized waits are connected to reads by thread id, which has gotta be wrong, so gonna need to write more tests.

After that there will be more fun.

The other things this fixes are:
* The structure of sceKernelReferThreadRunStatus() was missing size so everything was off by one, found this while testing thread end.
* sceKernelWakeupThread() is supposed to fail on the current thread.

-[Unknown]