diff options
| author | bunnei <bunneidev@gmail.com> | 2022-01-24 18:58:48 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-24 18:58:48 -0800 |
| commit | 4f9f55ec21e6eeb02a7cf20ff6398c72a4db0720 (patch) | |
| tree | 490b449ec20ae557f5069afdf7adfb82cbd57b34 /src/core/hle/kernel/k_process.cpp | |
| parent | 344236512770ad8c96b881064f2f6776da1b0451 (diff) | |
| parent | 59add00d4a37a8f7b1bc8b4c39e46fae35150540 (diff) | |
Merge pull request #7765 from bunnei/update-thread-count
hle: kernel: KThread: Improve Increment/Decrement RunningThreadCount.
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 265ac6fa1..85c506979 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -146,6 +146,13 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st // Open a reference to the resource limit. process->resource_limit->Open(); + // Clear remaining fields. + process->num_running_threads = 0; + process->is_signaled = false; + process->exception_thread = nullptr; + process->is_suspended = false; + process->schedule_count = 0; + return ResultSuccess; } @@ -157,20 +164,17 @@ KResourceLimit* KProcess::GetResourceLimit() const { return resource_limit; } -void KProcess::IncrementThreadCount() { - ASSERT(num_threads >= 0); - num_created_threads++; - - if (const auto count = ++num_threads; count > peak_num_threads) { - peak_num_threads = count; - } +void KProcess::IncrementRunningThreadCount() { + ASSERT(num_running_threads.load() >= 0); + ++num_running_threads; } -void KProcess::DecrementThreadCount() { - ASSERT(num_threads > 0); +void KProcess::DecrementRunningThreadCount() { + ASSERT(num_running_threads.load() > 0); - if (const auto count = --num_threads; count == 0) { - LOG_WARNING(Kernel, "Process termination is not fully implemented."); + if (const auto prev = num_running_threads--; prev == 1) { + // TODO(bunnei): Process termination to be implemented when multiprocess is supported. + UNIMPLEMENTED_MSG("KProcess termination is not implemennted!"); } } |
