// SDK location: /user/pspthreadman.h:179 // SDK declaration: int sceKernelDeleteThread(SceUID thid); public int sceKernelDeleteThread(int thid) { KThread thread = _kernel.GetHandle <KThread>(thid); if (thread == null) { return(-1); } // Don't support this if (_kernel.ActiveThread == thread) { thread.Exit(0); _kernel.Schedule(); Debug.Assert(_kernel.ActiveThread != thread); } if (thread.State != KThreadState.Dead) { Log.WriteLine(Verbosity.Critical, Feature.Bios, "sceKernelDeleteThread: thread {0:X} {1} is {2} - it must be dead to delete it properly!", thread.UID, thread.Name, thread.StackBlock); return(0); } Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelDeleteThread: deleting thread {0:X} {1}", thread.UID, thread.Name); thread.Delete(); _kernel.RemoveHandle(thread.UID); return(0); }
private void ExitThread() { KThread currentThread = _system.Scheduler.GetCurrentThread(); _system.Scheduler.ExitThread(currentThread); currentThread.Exit(); }
// SDK location: /user/pspthreadman.h:211 // SDK declaration: int sceKernelTerminateThread(SceUID thid); public int sceKernelTerminateThread(int thid) { KThread thread = _kernel.GetHandle <KThread>(thid); if (thread == null) { return(-1); } thread.Exit(0); return(0); }
// SDK location: /user/pspthreadman.h:195 // SDK declaration: int sceKernelExitThread(int status); public int sceKernelExitThread(int status) { KThread thread = _kernel.ActiveThread; if (thread == null) { return(-1); } thread.Exit(status); _kernel.Schedule(); return(0); }
private void KmoduleStopThreadEnd(int tcsId, int state) { // Our thread ended - kill it! KThread thread = _kernel.GetHandle <KThread>(( uint )state); Debug.Assert(thread != null); if (thread != null) { Log.WriteLine(Verbosity.Verbose, Feature.Bios, "ModuleMgrForUser: killing module_stop thread with UID {0:X}", thread.UID); thread.Exit(0); _kernel.RemoveHandle(thread.UID); _kernel.Schedule(); thread.Delete(); } }