diff options
| author | 2014-05-22 18:50:36 -0400 | |
|---|---|---|
| committer | 2014-05-22 18:50:36 -0400 | |
| commit | 14bd37c5dc67c7777d4bea8d996bf2dfd8c7bdcc (patch) | |
| tree | 1849fdeba7de9c6bd98b42c31a6c853af487acea /src/core/hle/kernel/thread.h | |
| parent | APT_U: added a debug log on calling GetLockHandle (diff) | |
| download | yuzu-14bd37c5dc67c7777d4bea8d996bf2dfd8c7bdcc.tar.gz yuzu-14bd37c5dc67c7777d4bea8d996bf2dfd8c7bdcc.tar.xz yuzu-14bd37c5dc67c7777d4bea8d996bf2dfd8c7bdcc.zip | |
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.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 0d1fe19bf..82bf16082 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -20,10 +20,31 @@ enum ThreadProcessorId { | |||
| 20 | THREADPROCESSORID_ALL = 0xFFFFFFFC, ///< Enables both cores | 20 | THREADPROCESSORID_ALL = 0xFFFFFFFC, ///< Enables both cores |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | enum ThreadStatus { | ||
| 24 | THREADSTATUS_RUNNING = 1, | ||
| 25 | THREADSTATUS_READY = 2, | ||
| 26 | THREADSTATUS_WAIT = 4, | ||
| 27 | THREADSTATUS_SUSPEND = 8, | ||
| 28 | THREADSTATUS_DORMANT = 16, | ||
| 29 | THREADSTATUS_DEAD = 32, | ||
| 30 | THREADSTATUS_WAITSUSPEND = THREADSTATUS_WAIT | THREADSTATUS_SUSPEND | ||
| 31 | }; | ||
| 32 | |||
| 33 | enum WaitType { | ||
| 34 | WAITTYPE_NONE, | ||
| 35 | WAITTYPE_SLEEP, | ||
| 36 | WAITTYPE_SEMA, | ||
| 37 | WAITTYPE_EVENTFLAG, | ||
| 38 | WAITTYPE_THREADEND, | ||
| 39 | WAITTYPE_VBLANK, | ||
| 40 | WAITTYPE_MUTEX, | ||
| 41 | WAITTYPE_SYNCH, | ||
| 42 | }; | ||
| 43 | |||
| 23 | namespace Kernel { | 44 | namespace Kernel { |
| 24 | 45 | ||
| 25 | /// Creates a new thread - wrapper for external user | 46 | /// Creates a new thread - wrapper for external user |
| 26 | Handle CreateThread(const char* name, u32 entry_point, s32 priority, s32 processor_id, | 47 | Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s32 processor_id, |
| 27 | u32 stack_top, int stack_size=Kernel::DEFAULT_STACK_SIZE); | 48 | u32 stack_top, int stack_size=Kernel::DEFAULT_STACK_SIZE); |
| 28 | 49 | ||
| 29 | /// Sets up the primary application thread | 50 | /// Sets up the primary application thread |
| @@ -32,6 +53,9 @@ Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE); | |||
| 32 | /// Reschedules to the next available thread (call after current thread is suspended) | 53 | /// Reschedules to the next available thread (call after current thread is suspended) |
| 33 | void Reschedule(const char* reason); | 54 | void Reschedule(const char* reason); |
| 34 | 55 | ||
| 56 | /// Puts a thread in the wait state for the given type/reason | ||
| 57 | void WaitCurThread(WaitType wait_type, const char* reason); | ||
| 58 | |||
| 35 | /// Resumes a thread from waiting by marking it as "ready" | 59 | /// Resumes a thread from waiting by marking it as "ready" |
| 36 | void ResumeThreadFromWait(Handle handle); | 60 | void ResumeThreadFromWait(Handle handle); |
| 37 | 61 | ||