mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
parent
a88f6b45d2
commit
dd2bd55bcb
1 changed files with 9 additions and 20 deletions
|
@ -1336,32 +1336,21 @@ u32 sceKernelReferThreadRunStatus(u32 threadID, u32 statusPtr)
|
|||
int __KernelGetThreadExitStatus(SceUID threadID) {
|
||||
u32 error;
|
||||
PSPThread *t = kernelObjects.Get<PSPThread>(threadID, error);
|
||||
if (t)
|
||||
{
|
||||
if (t->nt.status == THREADSTATUS_DORMANT) // TODO: can be dormant before starting, too, need to avoid that
|
||||
{
|
||||
DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus(%d)", threadID);
|
||||
return t->nt.exitStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus(%d): not dormant", threadID);
|
||||
return SCE_KERNEL_ERROR_NOT_DORMANT;
|
||||
}
|
||||
if (!t) {
|
||||
return hleLogError(SCEKERNEL, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus Error %08x", error);
|
||||
return SCE_KERNEL_ERROR_UNKNOWN_THID;
|
||||
|
||||
// __KernelResetThread and __KernelCreateThread set exitStatus in case it's DORMANT.
|
||||
if (t->nt.status == THREADSTATUS_DORMANT) {
|
||||
return hleLogSuccessI(SCEKERNEL, t->nt.exitStatus);
|
||||
}
|
||||
return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_NOT_DORMANT, "not dormant");
|
||||
}
|
||||
|
||||
int sceKernelGetThreadExitStatus(SceUID threadID)
|
||||
{
|
||||
int sceKernelGetThreadExitStatus(SceUID threadID) {
|
||||
u32 status = __KernelGetThreadExitStatus(threadID);
|
||||
// Seems this is called in a tight-ish loop, maybe awaiting an interrupt - issue #13698
|
||||
// Guess based on sceKernelGetThreadId.
|
||||
hleEatCycles(180);
|
||||
hleEatCycles(330);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue