diff options
author | Fernando S <fsahmkow27@gmail.com> | 2022-06-30 12:38:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-30 12:38:50 +0200 |
commit | 603952bc27aca2e17d39def7710d9af36791f15c (patch) | |
tree | 8b6b2f943bbf2fc749dbe144eee26cd144c084c9 /src/common/thread.cpp | |
parent | Merge pull request #8518 from yuzu-emu/revert-8379-amd-push-desc-workaround (diff) | |
parent | Adress Feedback. (diff) | |
download | yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar.gz yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar.bz2 yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar.lz yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar.xz yuzu-603952bc27aca2e17d39def7710d9af36791f15c.tar.zst yuzu-603952bc27aca2e17d39def7710d9af36791f15c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/thread.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index f932a7290..919e33af9 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -47,6 +47,9 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) { case ThreadPriority::VeryHigh: windows_priority = THREAD_PRIORITY_HIGHEST; break; + case ThreadPriority::Critical: + windows_priority = THREAD_PRIORITY_TIME_CRITICAL; + break; default: windows_priority = THREAD_PRIORITY_NORMAL; break; @@ -59,9 +62,10 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) { void SetCurrentThreadPriority(ThreadPriority new_priority) { pthread_t this_thread = pthread_self(); - s32 max_prio = sched_get_priority_max(SCHED_OTHER); - s32 min_prio = sched_get_priority_min(SCHED_OTHER); - u32 level = static_cast<u32>(new_priority) + 1; + const auto scheduling_type = SCHED_OTHER; + s32 max_prio = sched_get_priority_max(scheduling_type); + s32 min_prio = sched_get_priority_min(scheduling_type); + u32 level = std::max(static_cast<u32>(new_priority) + 1, 4U); struct sched_param params; if (max_prio > min_prio) { @@ -70,7 +74,7 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) { params.sched_priority = min_prio - ((min_prio - max_prio) * level) / 4; } - pthread_setschedparam(this_thread, SCHED_OTHER, ¶ms); + pthread_setschedparam(this_thread, scheduling_type, ¶ms); } #endif |