diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2022-12-16 11:57:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-16 11:57:42 -0500 |
| commit | b541a35e277577f0e7f76852510b52141de09fed (patch) | |
| tree | 62ed4b813c4184c898a7ca73021362534aa69b1e /src/core/hle/kernel/k_process.cpp | |
| parent | 6bc1a477bfba9f1ac60b864ddbccbfd61faa5f4c (diff) | |
| parent | 20cbf6f3db4f2873f0122aa45f65a0a410978199 (diff) | |
Merge pull request #9444 from german77/free_threads
kernel: process: Implement GetFreeThreadCount
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index d1dc62401..a1abf5d68 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -285,6 +285,17 @@ void KProcess::UnregisterThread(KThread* thread) { thread_list.remove(thread); } +u64 KProcess::GetFreeThreadCount() const { + if (resource_limit != nullptr) { + const auto current_value = + resource_limit->GetCurrentValue(LimitableResource::ThreadCountMax); + const auto limit_value = resource_limit->GetLimitValue(LimitableResource::ThreadCountMax); + return limit_value - current_value; + } else { + return 0; + } +} + Result KProcess::Reset() { // Lock the process and the scheduler. KScopedLightLock lk(state_lock); |
