summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.h
diff options
context:
space:
mode:
authorGravatar Sebastian Valle2017-09-30 09:12:18 -0500
committerGravatar GitHub2017-09-30 09:12:18 -0500
commitdb752b52e84227696af989c2ec1965020c03fac7 (patch)
tree04f1e6403bede1890252a0af047e2e149abdde4c /src/core/hle/kernel/thread.h
parentMerge pull request #2962 from huwpascoe/static_cast (diff)
parentKernel/Threads: When putting a thread to wait, specify a function to execute ... (diff)
downloadyuzu-db752b52e84227696af989c2ec1965020c03fac7.tar.gz
yuzu-db752b52e84227696af989c2ec1965020c03fac7.tar.xz
yuzu-db752b52e84227696af989c2ec1965020c03fac7.zip
Merge pull request #2967 from Subv/thread_wakeup_callbacks
Kernel/Threads: When putting a thread to wait, specify a function to execute when it is awoken
Diffstat (limited to 'src/core/hle/kernel/thread.h')
-rw-r--r--src/core/hle/kernel/thread.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index f02e1d43a..4679c2022 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -41,6 +41,11 @@ enum ThreadStatus {
41 THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated 41 THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated
42}; 42};
43 43
44enum class ThreadWakeupReason {
45 Signal, // The thread was woken up by WakeupAllWaitingThreads due to an object signal.
46 Timeout // The thread was woken up due to a wait timeout.
47};
48
44namespace Kernel { 49namespace Kernel {
45 50
46class Mutex; 51class Mutex;
@@ -199,14 +204,18 @@ public:
199 204
200 VAddr wait_address; ///< If waiting on an AddressArbiter, this is the arbitration address 205 VAddr wait_address; ///< If waiting on an AddressArbiter, this is the arbitration address
201 206
202 /// True if the WaitSynchronizationN output parameter should be set on thread wakeup.
203 bool wait_set_output;
204
205 std::string name; 207 std::string name;
206 208
207 /// Handle used as userdata to reference this object when inserting into the CoreTiming queue. 209 /// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
208 Handle callback_handle; 210 Handle callback_handle;
209 211
212 using WakeupCallback = void(ThreadWakeupReason reason, SharedPtr<Thread> thread,
213 SharedPtr<WaitObject> object);
214 // Callback that will be invoked when the thread is resumed from a waiting state. If the thread
215 // was waiting via WaitSynchronizationN then the object will be the last object that became
216 // available. In case of a timeout, the object will be nullptr.
217 std::function<WakeupCallback> wakeup_callback;
218
210private: 219private:
211 Thread(); 220 Thread();
212 ~Thread() override; 221 ~Thread() override;