diff options
| author | 2016-09-21 11:29:48 -0700 | |
|---|---|---|
| committer | 2016-09-21 11:29:48 -0700 | |
| commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
| tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/core/hle/kernel/thread.h | |
| parent | README: Specify master branch for Travis CI badge (diff) | |
| parent | Fix Travis clang-format check (diff) | |
| download | yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip | |
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/core/hle/kernel/thread.h')
| -rw-r--r-- | src/core/hle/kernel/thread.h | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index deab5d5a6..f63131716 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -6,40 +6,36 @@ | |||
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | |||
| 10 | #include <boost/container/flat_set.hpp> | 9 | #include <boost/container/flat_set.hpp> |
| 11 | |||
| 12 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 13 | |||
| 14 | #include "core/core.h" | 11 | #include "core/core.h" |
| 15 | |||
| 16 | #include "core/hle/hle.h" | 12 | #include "core/hle/hle.h" |
| 17 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/kernel.h" |
| 18 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 19 | 15 | ||
| 20 | enum ThreadPriority : s32{ | 16 | enum ThreadPriority : s32 { |
| 21 | THREADPRIO_HIGHEST = 0, ///< Highest thread priority | 17 | THREADPRIO_HIGHEST = 0, ///< Highest thread priority |
| 22 | THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps | 18 | THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps |
| 23 | THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps | 19 | THREADPRIO_DEFAULT = 48, ///< Default thread priority for userland apps |
| 24 | THREADPRIO_LOWEST = 63, ///< Lowest thread priority | 20 | THREADPRIO_LOWEST = 63, ///< Lowest thread priority |
| 25 | }; | 21 | }; |
| 26 | 22 | ||
| 27 | enum ThreadProcessorId : s32 { | 23 | enum ThreadProcessorId : s32 { |
| 28 | THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader | 24 | THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader |
| 29 | THREADPROCESSORID_ALL = -1, ///< Run thread on either core | 25 | THREADPROCESSORID_ALL = -1, ///< Run thread on either core |
| 30 | THREADPROCESSORID_0 = 0, ///< Run thread on core 0 (AppCore) | 26 | THREADPROCESSORID_0 = 0, ///< Run thread on core 0 (AppCore) |
| 31 | THREADPROCESSORID_1 = 1, ///< Run thread on core 1 (SysCore) | 27 | THREADPROCESSORID_1 = 1, ///< Run thread on core 1 (SysCore) |
| 32 | THREADPROCESSORID_MAX = 2, ///< Processor ID must be less than this | 28 | THREADPROCESSORID_MAX = 2, ///< Processor ID must be less than this |
| 33 | }; | 29 | }; |
| 34 | 30 | ||
| 35 | enum ThreadStatus { | 31 | enum ThreadStatus { |
| 36 | THREADSTATUS_RUNNING, ///< Currently running | 32 | THREADSTATUS_RUNNING, ///< Currently running |
| 37 | THREADSTATUS_READY, ///< Ready to run | 33 | THREADSTATUS_READY, ///< Ready to run |
| 38 | THREADSTATUS_WAIT_ARB, ///< Waiting on an address arbiter | 34 | THREADSTATUS_WAIT_ARB, ///< Waiting on an address arbiter |
| 39 | THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC | 35 | THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC |
| 40 | THREADSTATUS_WAIT_SYNCH, ///< Waiting due to a WaitSynchronization SVC | 36 | THREADSTATUS_WAIT_SYNCH, ///< Waiting due to a WaitSynchronization SVC |
| 41 | THREADSTATUS_DORMANT, ///< Created but not yet made ready | 37 | THREADSTATUS_DORMANT, ///< Created but not yet made ready |
| 42 | THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated | 38 | THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated |
| 43 | }; | 39 | }; |
| 44 | 40 | ||
| 45 | namespace Kernel { | 41 | namespace Kernel { |
| @@ -60,13 +56,19 @@ public: | |||
| 60 | * @return A shared pointer to the newly created thread | 56 | * @return A shared pointer to the newly created thread |
| 61 | */ | 57 | */ |
| 62 | static ResultVal<SharedPtr<Thread>> Create(std::string name, VAddr entry_point, s32 priority, | 58 | static ResultVal<SharedPtr<Thread>> Create(std::string name, VAddr entry_point, s32 priority, |
| 63 | u32 arg, s32 processor_id, VAddr stack_top); | 59 | u32 arg, s32 processor_id, VAddr stack_top); |
| 64 | 60 | ||
| 65 | std::string GetName() const override { return name; } | 61 | std::string GetName() const override { |
| 66 | std::string GetTypeName() const override { return "Thread"; } | 62 | return name; |
| 63 | } | ||
| 64 | std::string GetTypeName() const override { | ||
| 65 | return "Thread"; | ||
| 66 | } | ||
| 67 | 67 | ||
| 68 | static const HandleType HANDLE_TYPE = HandleType::Thread; | 68 | static const HandleType HANDLE_TYPE = HandleType::Thread; |
| 69 | HandleType GetHandleType() const override { return HANDLE_TYPE; } | 69 | HandleType GetHandleType() const override { |
| 70 | return HANDLE_TYPE; | ||
| 71 | } | ||
| 70 | 72 | ||
| 71 | bool ShouldWait() override; | 73 | bool ShouldWait() override; |
| 72 | void Acquire() override; | 74 | void Acquire() override; |
| @@ -75,7 +77,9 @@ public: | |||
| 75 | * Gets the thread's current priority | 77 | * Gets the thread's current priority |
| 76 | * @return The current thread's priority | 78 | * @return The current thread's priority |
| 77 | */ | 79 | */ |
| 78 | s32 GetPriority() const { return current_priority; } | 80 | s32 GetPriority() const { |
| 81 | return current_priority; | ||
| 82 | } | ||
| 79 | 83 | ||
| 80 | /** | 84 | /** |
| 81 | * Sets the thread's current priority | 85 | * Sets the thread's current priority |
| @@ -93,7 +97,9 @@ public: | |||
| 93 | * Gets the thread's thread ID | 97 | * Gets the thread's thread ID |
| 94 | * @return The thread's ID | 98 | * @return The thread's ID |
| 95 | */ | 99 | */ |
| 96 | u32 GetThreadId() const { return thread_id; } | 100 | u32 GetThreadId() const { |
| 101 | return thread_id; | ||
| 102 | } | ||
| 97 | 103 | ||
| 98 | /** | 104 | /** |
| 99 | * Resumes a thread from waiting | 105 | * Resumes a thread from waiting |
| @@ -127,7 +133,9 @@ public: | |||
| 127 | * Returns the Thread Local Storage address of the current thread | 133 | * Returns the Thread Local Storage address of the current thread |
| 128 | * @returns VAddr of the thread's TLS | 134 | * @returns VAddr of the thread's TLS |
| 129 | */ | 135 | */ |
| 130 | VAddr GetTLSAddress() const { return tls_address; } | 136 | VAddr GetTLSAddress() const { |
| 137 | return tls_address; | ||
| 138 | } | ||
| 131 | 139 | ||
| 132 | Core::ThreadContext context; | 140 | Core::ThreadContext context; |
| 133 | 141 | ||
| @@ -137,8 +145,8 @@ public: | |||
| 137 | u32 entry_point; | 145 | u32 entry_point; |
| 138 | u32 stack_top; | 146 | u32 stack_top; |
| 139 | 147 | ||
| 140 | s32 nominal_priority; ///< Nominal thread priority, as set by the emulated application | 148 | s32 nominal_priority; ///< Nominal thread priority, as set by the emulated application |
| 141 | s32 current_priority; ///< Current thread priority, can be temporarily changed | 149 | s32 current_priority; ///< Current thread priority, can be temporarily changed |
| 142 | 150 | ||
| 143 | u64 last_running_ticks; ///< CPU tick when thread was last running | 151 | u64 last_running_ticks; ///< CPU tick when thread was last running |
| 144 | 152 | ||
| @@ -151,11 +159,11 @@ public: | |||
| 151 | /// Mutexes currently held by this thread, which will be released when it exits. | 159 | /// Mutexes currently held by this thread, which will be released when it exits. |
| 152 | boost::container::flat_set<SharedPtr<Mutex>> held_mutexes; | 160 | boost::container::flat_set<SharedPtr<Mutex>> held_mutexes; |
| 153 | 161 | ||
| 154 | SharedPtr<Process> owner_process; ///< Process that owns this thread | 162 | SharedPtr<Process> owner_process; ///< Process that owns this thread |
| 155 | std::vector<SharedPtr<WaitObject>> wait_objects; ///< Objects that the thread is waiting on | 163 | std::vector<SharedPtr<WaitObject>> wait_objects; ///< Objects that the thread is waiting on |
| 156 | VAddr wait_address; ///< If waiting on an AddressArbiter, this is the arbitration address | 164 | VAddr wait_address; ///< If waiting on an AddressArbiter, this is the arbitration address |
| 157 | bool wait_all; ///< True if the thread is waiting on all objects before resuming | 165 | bool wait_all; ///< True if the thread is waiting on all objects before resuming |
| 158 | bool wait_set_output; ///< True if the output parameter should be set on thread wakeup | 166 | bool wait_set_output; ///< True if the output parameter should be set on thread wakeup |
| 159 | 167 | ||
| 160 | std::string name; | 168 | std::string name; |
| 161 | 169 | ||
| @@ -205,10 +213,12 @@ void WaitCurrentThread_Sleep(); | |||
| 205 | /** | 213 | /** |
| 206 | * Waits the current thread from a WaitSynchronization call | 214 | * Waits the current thread from a WaitSynchronization call |
| 207 | * @param wait_objects Kernel objects that we are waiting on | 215 | * @param wait_objects Kernel objects that we are waiting on |
| 208 | * @param wait_set_output If true, set the output parameter on thread wakeup (for WaitSynchronizationN only) | 216 | * @param wait_set_output If true, set the output parameter on thread wakeup (for |
| 217 | * WaitSynchronizationN only) | ||
| 209 | * @param wait_all If true, wait on all objects before resuming (for WaitSynchronizationN only) | 218 | * @param wait_all If true, wait on all objects before resuming (for WaitSynchronizationN only) |
| 210 | */ | 219 | */ |
| 211 | void WaitCurrentThread_WaitSynchronization(std::vector<SharedPtr<WaitObject>> wait_objects, bool wait_set_output, bool wait_all); | 220 | void WaitCurrentThread_WaitSynchronization(std::vector<SharedPtr<WaitObject>> wait_objects, |
| 221 | bool wait_set_output, bool wait_all); | ||
| 212 | 222 | ||
| 213 | /** | 223 | /** |
| 214 | * Waits the current thread from an ArbitrateAddress call | 224 | * Waits the current thread from an ArbitrateAddress call |