aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/kernel/thread.h
diff options
context:
space:
mode:
authorGravatar bunnei <ericbunnie@gmail.com>2014-05-22 18:50:36 -0400
committerGravatar bunnei <ericbunnie@gmail.com>2014-05-22 18:50:36 -0400
commit14bd37c5dc67c7777d4bea8d996bf2dfd8c7bdcc (patch)
tree1849fdeba7de9c6bd98b42c31a6c853af487acea /src/core/hle/kernel/thread.h
parent9fddba68435f6e276bfb40c793f1ca0f8b984ec9 (diff)
thread: moved ThreadStatus/WaitType to header, added support for arg on CreateThread, added correct CPSR reset
Diffstat (limited to 'src/core/hle/kernel/thread.h')
-rw-r--r--src/core/hle/kernel/thread.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 0d1fe19b..82bf1608 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -20,10 +20,31 @@ enum ThreadProcessorId {
THREADPROCESSORID_ALL = 0xFFFFFFFC, ///< Enables both cores
};
+enum ThreadStatus {
+ THREADSTATUS_RUNNING = 1,
+ THREADSTATUS_READY = 2,
+ THREADSTATUS_WAIT = 4,
+ THREADSTATUS_SUSPEND = 8,
+ THREADSTATUS_DORMANT = 16,
+ THREADSTATUS_DEAD = 32,
+ THREADSTATUS_WAITSUSPEND = THREADSTATUS_WAIT | THREADSTATUS_SUSPEND
+};
+
+enum WaitType {
+ WAITTYPE_NONE,
+ WAITTYPE_SLEEP,
+ WAITTYPE_SEMA,
+ WAITTYPE_EVENTFLAG,
+ WAITTYPE_THREADEND,
+ WAITTYPE_VBLANK,
+ WAITTYPE_MUTEX,
+ WAITTYPE_SYNCH,
+};
+
namespace Kernel {
/// Creates a new thread - wrapper for external user
-Handle CreateThread(const char* name, u32 entry_point, s32 priority, s32 processor_id,
+Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s32 processor_id,
u32 stack_top, int stack_size=Kernel::DEFAULT_STACK_SIZE);
/// Sets up the primary application thread
@@ -32,6 +53,9 @@ Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE);
/// Reschedules to the next available thread (call after current thread is suspended)
void Reschedule(const char* reason);
+/// Puts a thread in the wait state for the given type/reason
+void WaitCurThread(WaitType wait_type, const char* reason);
+
/// Resumes a thread from waiting by marking it as "ready"
void ResumeThreadFromWait(Handle handle);