diff options
| author | 2015-04-09 23:05:49 -0400 | |
|---|---|---|
| committer | 2015-04-09 23:05:49 -0400 | |
| commit | 6f1143885bcc02642b707b51355fe4b6cd5375c7 (patch) | |
| tree | fe1307919e7087df41c498b971016ffa931d6594 /src/core/hle/kernel/thread.h | |
| parent | Merge pull request #690 from Zaneo/sharedmemory (diff) | |
| parent | SVC: Assert on unsupported CreateThread processor ID. (diff) | |
| download | yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.gz yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.xz yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.zip | |
Merge pull request #683 from bunnei/thread-priority
Thread priority and scheduler improvements
Diffstat (limited to 'src/core/hle/kernel/thread.h')
| -rw-r--r-- | src/core/hle/kernel/thread.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index cfd073a70..233bcbdbd 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -17,17 +17,19 @@ | |||
| 17 | #include "core/hle/kernel/kernel.h" | 17 | #include "core/hle/kernel/kernel.h" |
| 18 | #include "core/hle/result.h" | 18 | #include "core/hle/result.h" |
| 19 | 19 | ||
| 20 | enum ThreadPriority { | 20 | enum ThreadPriority : s32{ |
| 21 | THREADPRIO_HIGHEST = 0, ///< Highest thread priority | 21 | THREADPRIO_HIGHEST = 0, ///< Highest thread priority |
| 22 | THREADPRIO_DEFAULT = 16, ///< Default thread priority for userland apps | 22 | THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps |
| 23 | THREADPRIO_LOW = 31, ///< Low range of thread priority for userland apps | 23 | THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps |
| 24 | THREADPRIO_LOWEST = 63, ///< Thread priority max checked by svcCreateThread | 24 | THREADPRIO_LOWEST = 63, ///< Lowest thread priority |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | enum ThreadProcessorId { | 27 | enum ThreadProcessorId : s32 { |
| 28 | THREADPROCESSORID_0 = 0xFFFFFFFE, ///< Enables core appcode | 28 | THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader |
| 29 | THREADPROCESSORID_1 = 0xFFFFFFFD, ///< Enables core syscore | 29 | THREADPROCESSORID_ALL = -1, ///< Run thread on either core |
| 30 | THREADPROCESSORID_ALL = 0xFFFFFFFC, ///< Enables both cores | 30 | THREADPROCESSORID_0 = 0, ///< Run thread on core 0 (AppCore) |
| 31 | THREADPROCESSORID_1 = 1, ///< Run thread on core 1 (SysCore) | ||
| 32 | THREADPROCESSORID_MAX = 2, ///< Processor ID must be less than this | ||
| 31 | }; | 33 | }; |
| 32 | 34 | ||
| 33 | enum ThreadStatus { | 35 | enum ThreadStatus { |
| @@ -88,6 +90,12 @@ public: | |||
| 88 | void SetPriority(s32 priority); | 90 | void SetPriority(s32 priority); |
| 89 | 91 | ||
| 90 | /** | 92 | /** |
| 93 | * Temporarily boosts the thread's priority until the next time it is scheduled | ||
| 94 | * @param priority The new priority | ||
| 95 | */ | ||
| 96 | void BoostPriority(s32 priority); | ||
| 97 | |||
| 98 | /** | ||
| 91 | * Gets the thread's thread ID | 99 | * Gets the thread's thread ID |
| 92 | * @return The thread's ID | 100 | * @return The thread's ID |
| 93 | */ | 101 | */ |
| @@ -135,8 +143,10 @@ public: | |||
| 135 | u32 entry_point; | 143 | u32 entry_point; |
| 136 | u32 stack_top; | 144 | u32 stack_top; |
| 137 | 145 | ||
| 138 | s32 initial_priority; | 146 | s32 nominal_priority; ///< Nominal thread priority, as set by the emulated application |
| 139 | s32 current_priority; | 147 | s32 current_priority; ///< Current thread priority, can be temporarily changed |
| 148 | |||
| 149 | u64 last_running_ticks; ///< CPU tick when thread was last running | ||
| 140 | 150 | ||
| 141 | s32 processor_id; | 151 | s32 processor_id; |
| 142 | 152 | ||