core/hle/kernel: Make Mutex a per-process class.

Makes it an instantiable class like it is in the actual kernel. This
will also allow removing reliance on global accessors in a following
change, now that we can encapsulate a reference to the system instance
in the class.
This commit is contained in:
Lioncash 2019-03-14 00:29:54 -04:00
parent 2d9546848e
commit 555cd26ec2
5 changed files with 47 additions and 18 deletions

View file

@ -14,6 +14,7 @@
#include "common/common_types.h"
#include "core/hle/kernel/address_arbiter.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/process_capability.h"
#include "core/hle/kernel/vm_manager.h"
#include "core/hle/kernel/wait_object.h"
@ -165,6 +166,16 @@ public:
return address_arbiter;
}
/// Gets a reference to the process' mutex lock.
Mutex& GetMutex() {
return mutex;
}
/// Gets a const reference to the process' mutex lock
const Mutex& GetMutex() const {
return mutex;
}
/// Gets the current status of the process
ProcessStatus GetStatus() const {
return status;
@ -327,6 +338,11 @@ private:
/// Per-process address arbiter.
AddressArbiter address_arbiter;
/// The per-process mutex lock instance used for handling various
/// forms of services, such as lock arbitration, and condition
/// variable related facilities.
Mutex mutex;
/// Random values for svcGetInfo RandomEntropy
std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy;