summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-01-31 16:55:11 -0800
committerGravatar bunnei2021-02-05 14:03:36 -0800
commiteba3c59a611962a1b019a5edfbc16c8d6db58be9 (patch)
tree01bf9363df380825ad1b13f22e8944ffbc460682 /src/core/hle/kernel/process.cpp
parentcommon: scope_exit: Add a cancellable ScopeExit macro. (diff)
downloadyuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.gz
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.xz
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.zip
hle: kernel: svc: Cleanup KEvent/KReadableEvent/KWritableEvent SVCs.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index afdb27c54..2286b292d 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -23,6 +23,7 @@
23#include "core/hle/kernel/memory/page_table.h" 23#include "core/hle/kernel/memory/page_table.h"
24#include "core/hle/kernel/memory/slab_heap.h" 24#include "core/hle/kernel/memory/slab_heap.h"
25#include "core/hle/kernel/process.h" 25#include "core/hle/kernel/process.h"
26#include "core/hle/kernel/svc_results.h"
26#include "core/hle/lock.h" 27#include "core/hle/lock.h"
27#include "core/memory.h" 28#include "core/memory.h"
28#include "core/settings.h" 29#include "core/settings.h"
@@ -241,18 +242,16 @@ void Process::UnregisterThread(const KThread* thread) {
241 thread_list.remove(thread); 242 thread_list.remove(thread);
242} 243}
243 244
244ResultCode Process::ClearSignalState() { 245ResultCode Process::Reset() {
245 KScopedSchedulerLock lock(system.Kernel()); 246 // Lock the process and the scheduler.
246 if (status == ProcessStatus::Exited) { 247 KScopedLightLock lk(state_lock);
247 LOG_ERROR(Kernel, "called on a terminated process instance."); 248 KScopedSchedulerLock sl{kernel};
248 return ERR_INVALID_STATE;
249 }
250 249
251 if (!is_signaled) { 250 // Validate that we're in a state that we can reset.
252 LOG_ERROR(Kernel, "called on a process instance that isn't signaled."); 251 R_UNLESS(status != ProcessStatus::Exited, Svc::ResultInvalidState);
253 return ERR_INVALID_STATE; 252 R_UNLESS(is_signaled, Svc::ResultInvalidState);
254 }
255 253
254 // Clear signaled.
256 is_signaled = false; 255 is_signaled = false;
257 return RESULT_SUCCESS; 256 return RESULT_SUCCESS;
258} 257}