mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
stratosphere: Use RAII for locks
This renames the Mutex class member functions so that the mutex types satisfy Lockable. This makes them usable with standard std::scoped_lock and std::unique_lock, which lets us use RAII and avoids the need for a custom RAII wrapper :)
This commit is contained in:
parent
18153713d9
commit
5b3e8e1c5d
11 changed files with 52 additions and 91 deletions
|
@ -90,7 +90,7 @@ std::tuple<Result, u64> ShellService::launch_process(u64 launch_flags, Registrat
|
|||
}
|
||||
|
||||
std::tuple<Result> ShellService::terminate_process_id(u64 pid) {
|
||||
Registration::AutoProcessListLock auto_lock;
|
||||
auto auto_lock = Registration::GetProcessListUniqueLock();
|
||||
|
||||
std::shared_ptr<Registration::Process> proc = Registration::GetProcess(pid);
|
||||
if (proc != NULL) {
|
||||
|
@ -101,7 +101,7 @@ std::tuple<Result> ShellService::terminate_process_id(u64 pid) {
|
|||
}
|
||||
|
||||
std::tuple<Result> ShellService::terminate_title_id(u64 tid) {
|
||||
Registration::AutoProcessListLock auto_lock;
|
||||
auto auto_lock = Registration::GetProcessListUniqueLock();
|
||||
|
||||
std::shared_ptr<Registration::Process> proc = Registration::GetProcessByTitleId(tid);
|
||||
if (proc != NULL) {
|
||||
|
@ -122,7 +122,7 @@ std::tuple<Result, u64, u64> ShellService::get_process_event_type() {
|
|||
}
|
||||
|
||||
std::tuple<Result> ShellService::finalize_exited_process(u64 pid) {
|
||||
Registration::AutoProcessListLock auto_lock;
|
||||
auto auto_lock = Registration::GetProcessListUniqueLock();
|
||||
|
||||
std::shared_ptr<Registration::Process> proc = Registration::GetProcess(pid);
|
||||
if (proc == NULL) {
|
||||
|
@ -136,7 +136,7 @@ std::tuple<Result> ShellService::finalize_exited_process(u64 pid) {
|
|||
}
|
||||
|
||||
std::tuple<Result> ShellService::clear_process_notification_flag(u64 pid) {
|
||||
Registration::AutoProcessListLock auto_lock;
|
||||
auto auto_lock = Registration::GetProcessListUniqueLock();
|
||||
|
||||
std::shared_ptr<Registration::Process> proc = Registration::GetProcess(pid);
|
||||
if (proc != NULL) {
|
||||
|
@ -157,7 +157,7 @@ std::tuple<Result> ShellService::notify_boot_finished() {
|
|||
}
|
||||
|
||||
std::tuple<Result, u64> ShellService::get_application_process_id() {
|
||||
Registration::AutoProcessListLock auto_lock;
|
||||
auto auto_lock = Registration::GetProcessListUniqueLock();
|
||||
|
||||
std::shared_ptr<Registration::Process> app_proc;
|
||||
if (Registration::HasApplicationProcess(&app_proc)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue