diff --git a/src/util/thread.h b/src/util/thread.h index f0c894838..c96cb1c08 100644 --- a/src/util/thread.h +++ b/src/util/thread.h @@ -11,6 +11,17 @@ namespace dxvk { + /** + * \brief Thread priority + */ + enum class ThreadPriority : int32_t { + Lowest = THREAD_PRIORITY_LOWEST, + Low = THREAD_PRIORITY_BELOW_NORMAL, + Normal = THREAD_PRIORITY_NORMAL, + High = THREAD_PRIORITY_ABOVE_NORMAL, + Highest = THREAD_PRIORITY_HIGHEST, + }; + /** * \brief Thread helper class * @@ -56,6 +67,10 @@ namespace dxvk { return m_handle != nullptr; } + void set_priority(ThreadPriority priority) { + ::SetThreadPriority(m_handle, int32_t(priority)); + } + private: Proc m_proc; @@ -106,6 +121,10 @@ namespace dxvk { return m_thread != nullptr && m_thread->joinable(); } + + void set_priority(ThreadPriority priority) { + m_thread->set_priority(priority); + } static uint32_t hardware_concurrency() { SYSTEM_INFO info = { };