summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-02-01 01:55:11 +0100
committerbunnei <bunneidev@gmail.com>2021-02-05 23:03:36 +0100
commiteba3c59a611962a1b019a5edfbc16c8d6db58be9 (patch)
tree01bf9363df380825ad1b13f22e8944ffbc460682 /src/core/hle/kernel/process.cpp
parentcommon: scope_exit: Add a cancellable ScopeExit macro. (diff)
downloadyuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.gz
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.bz2
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.lz
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.xz
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.tar.zst
yuzu-eba3c59a611962a1b019a5edfbc16c8d6db58be9.zip
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 @@
#include "core/hle/kernel/memory/page_table.h"
#include "core/hle/kernel/memory/slab_heap.h"
#include "core/hle/kernel/process.h"
+#include "core/hle/kernel/svc_results.h"
#include "core/hle/lock.h"
#include "core/memory.h"
#include "core/settings.h"
@@ -241,18 +242,16 @@ void Process::UnregisterThread(const KThread* thread) {
thread_list.remove(thread);
}
-ResultCode Process::ClearSignalState() {
- KScopedSchedulerLock lock(system.Kernel());
- if (status == ProcessStatus::Exited) {
- LOG_ERROR(Kernel, "called on a terminated process instance.");
- return ERR_INVALID_STATE;
- }
+ResultCode Process::Reset() {
+ // Lock the process and the scheduler.
+ KScopedLightLock lk(state_lock);
+ KScopedSchedulerLock sl{kernel};
- if (!is_signaled) {
- LOG_ERROR(Kernel, "called on a process instance that isn't signaled.");
- return ERR_INVALID_STATE;
- }
+ // Validate that we're in a state that we can reset.
+ R_UNLESS(status != ProcessStatus::Exited, Svc::ResultInvalidState);
+ R_UNLESS(is_signaled, Svc::ResultInvalidState);
+ // Clear signaled.
is_signaled = false;
return RESULT_SUCCESS;
}