// SDK location: /user/pspthreadman.h:311 // SDK declaration: int sceKernelWaitThreadEndCB(SceUID thid, SceUInt *timeout); public int sceKernelWaitThreadEndCB(int thid, int timeout) { KThread thread = _kernel.ActiveThread; if (thread == null) { return(-1); } KThread targetThread = _kernel.GetHandle <KThread>(thid); if (targetThread == null) { return(-1); } // If already stopped, return if ((targetThread.State == KThreadState.Dead) || (targetThread.State == KThreadState.Stopped)) { return(0); } uint timeoutUs = 0; if (timeout != 0) { unsafe { uint *ptimeout = ( uint * )_memorySystem.Translate(( uint )timeout); timeoutUs = *ptimeout; } } thread.Join(targetThread, timeoutUs, true); return(0); }