@ -49,8 +49,7 @@ enum class ThreadStatus {
WaitHLEEvent , ///< Waiting for hle event to finish
WaitHLEEvent , ///< Waiting for hle event to finish
WaitSleep , ///< Waiting due to a SleepThread SVC
WaitSleep , ///< Waiting due to a SleepThread SVC
WaitIPC , ///< Waiting for the reply from an IPC request
WaitIPC , ///< Waiting for the reply from an IPC request
WaitSynchAny , ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
WaitSynch , ///< Waiting due to WaitSynchronization
WaitSynchAll , ///< Waiting due to WaitSynchronizationN with wait_all = true
WaitMutex , ///< Waiting due to an ArbitrateLock svc
WaitMutex , ///< Waiting due to an ArbitrateLock svc
WaitCondVar , ///< Waiting due to an WaitProcessWideKey svc
WaitCondVar , ///< Waiting due to an WaitProcessWideKey svc
WaitArb , ///< Waiting due to a SignalToAddress/WaitForAddress svc
WaitArb , ///< Waiting due to a SignalToAddress/WaitForAddress svc
@ -185,24 +184,27 @@ public:
void CancelWakeupTimer ( ) ;
void CancelWakeupTimer ( ) ;
/**
/**
* Sets the result after the thread awakens ( from either WaitSynchronization SVC )
* Sets the result after the thread awakens ( from svcWaitSynchronization )
* @ param result Value to set to the returned result
* @ param result Value to set to the returned result
*/
*/
void SetWaitSynchronizationResult ( ResultCode result ) ;
void SetWaitSynchronizationResult ( ResultCode result ) ;
/**
/**
* Sets the output parameter value after the thread awakens ( from WaitSynchronizationN SVC only )
* Sets the output parameter value after the thread awakens ( from svc WaitSynchronization)
* @ param output Value to set to the output parameter
* @ param output Value to set to the output parameter
*/
*/
void SetWaitSynchronizationOutput ( s32 output ) ;
void SetWaitSynchronizationOutput ( s32 output ) ;
/**
/**
* Retrieves the index that this particular object occupies in the list of objects
* Retrieves the index that this particular object occupies in the list of objects
* that the thread passed to WaitSynchronizationN , starting the search from the last element .
* that the thread passed to WaitSynchronization , starting the search from the last element .
* It is used to set the output value of WaitSynchronizationN when the thread is awakened .
*
* It is used to set the output index of WaitSynchronization when the thread is awakened .
*
* When a thread wakes up due to an object signal , the kernel will use the index of the last
* When a thread wakes up due to an object signal , the kernel will use the index of the last
* matching object in the wait objects list in case of having multiple instances of the same
* matching object in the wait objects list in case of having multiple instances of the same
* object in the list .
* object in the list .
*
* @ param object Object to query the index of .
* @ param object Object to query the index of .
*/
*/
s32 GetWaitObjectIndex ( const WaitObject * object ) const ;
s32 GetWaitObjectIndex ( const WaitObject * object ) const ;
@ -239,13 +241,9 @@ public:
*/
*/
VAddr GetCommandBufferAddress ( ) const ;
VAddr GetCommandBufferAddress ( ) const ;
/**
/// Returns whether this thread is waiting on objects from a WaitSynchronization call.
* Returns whether this thread is waiting for all the objects in
bool IsSleepingOnWait ( ) const {
* its wait list to become ready , as a result of a WaitSynchronizationN call
return status = = ThreadStatus : : WaitSynch ;
* with wait_all = true .
*/
bool IsSleepingOnWaitAll ( ) const {
return status = = ThreadStatus : : WaitSynchAll ;
}
}
ThreadContext & GetContext ( ) {
ThreadContext & GetContext ( ) {
@ -423,7 +421,7 @@ private:
Process * owner_process ;
Process * owner_process ;
/// Objects that the thread is waiting on, in the same order as they were
/// Objects that the thread is waiting on, in the same order as they were
/// passed to WaitSynchronization 1/N .
/// passed to WaitSynchronization .
ThreadWaitObjects wait_objects ;
ThreadWaitObjects wait_objects ;
/// List of threads that are waiting for a mutex that is held by this thread.
/// List of threads that are waiting for a mutex that is held by this thread.
@ -449,7 +447,7 @@ private:
Handle callback_handle = 0 ;
Handle callback_handle = 0 ;
/// Callback that will be invoked when the thread is resumed from a waiting state. If the thread
/// Callback that will be invoked when the thread is resumed from a waiting state. If the thread
/// was waiting via WaitSynchronization N then the object will be the last object that became
/// was waiting via WaitSynchronization then the object will be the last object that became
/// available. In case of a timeout, the object will be nullptr.
/// available. In case of a timeout, the object will be nullptr.
WakeupCallback wakeup_callback ;
WakeupCallback wakeup_callback ;