summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-12-21 22:36:53 -0800
committerGravatar bunnei2021-01-11 14:23:16 -0800
commit35c3c078e3c079c0a9192b411e20c71b122ff057 (patch)
tree572c0b6a47a249a78d658122de32908262ec6a69 /src/core/hle/kernel/process.cpp
parentcore: hle: kernel: Begin moving common SVC results to its own header. (diff)
downloadyuzu-35c3c078e3c079c0a9192b411e20c71b122ff057.tar.gz
yuzu-35c3c078e3c079c0a9192b411e20c71b122ff057.tar.xz
yuzu-35c3c078e3c079c0a9192b411e20c71b122ff057.zip
core: hle: kernel: Update KSynchronizationObject.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index b905b486a..92e877c3e 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -55,7 +55,7 @@ void SetupMainThread(Core::System& system, Process& owner_process, u32 priority,
55 // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires 55 // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires
56 { 56 {
57 KScopedSchedulerLock lock{kernel}; 57 KScopedSchedulerLock lock{kernel};
58 thread->SetStatus(ThreadStatus::Ready); 58 thread->SetState(ThreadStatus::Ready);
59 } 59 }
60} 60}
61} // Anonymous namespace 61} // Anonymous namespace
@@ -406,21 +406,18 @@ void Process::LoadModule(CodeSet code_set, VAddr base_addr) {
406 ReprotectSegment(code_set.DataSegment(), Memory::MemoryPermission::ReadAndWrite); 406 ReprotectSegment(code_set.DataSegment(), Memory::MemoryPermission::ReadAndWrite);
407} 407}
408 408
409bool Process::IsSignaled() const {
410 ASSERT(kernel.GlobalSchedulerContext().IsLocked());
411 return is_signaled;
412}
413
409Process::Process(Core::System& system) 414Process::Process(Core::System& system)
410 : SynchronizationObject{system.Kernel()}, page_table{std::make_unique<Memory::PageTable>( 415 : KSynchronizationObject{system.Kernel()}, page_table{std::make_unique<Memory::PageTable>(
411 system)}, 416 system)},
412 handle_table{system.Kernel()}, address_arbiter{system}, mutex{system}, system{system} {} 417 handle_table{system.Kernel()}, address_arbiter{system}, mutex{system}, system{system} {}
413 418
414Process::~Process() = default; 419Process::~Process() = default;
415 420
416void Process::Acquire(Thread* thread) {
417 ASSERT_MSG(!ShouldWait(thread), "Object unavailable!");
418}
419
420bool Process::ShouldWait(const Thread* thread) const {
421 return !is_signaled;
422}
423
424void Process::ChangeStatus(ProcessStatus new_status) { 421void Process::ChangeStatus(ProcessStatus new_status) {
425 if (status == new_status) { 422 if (status == new_status) {
426 return; 423 return;
@@ -428,7 +425,7 @@ void Process::ChangeStatus(ProcessStatus new_status) {
428 425
429 status = new_status; 426 status = new_status;
430 is_signaled = true; 427 is_signaled = true;
431 Signal(); 428 NotifyAvailable();
432} 429}
433 430
434ResultCode Process::AllocateMainThreadStack(std::size_t stack_size) { 431ResultCode Process::AllocateMainThreadStack(std::size_t stack_size) {