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:
parent
6adf534589
commit
305168d2bb
@ -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 = { };
|
||||
|
Loading…
x
Reference in New Issue
Block a user