1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[util] Add method to set thread priority

This commit is contained in:
Philip Rebohle 2018-11-15 12:17:18 +01:00
parent 6adf534589
commit 305168d2bb
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -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 = { };