mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[util] Add method to set thread priority
This commit is contained in:
parent
6adf534589
commit
305168d2bb
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
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
|
* \brief Thread helper class
|
||||||
*
|
*
|
||||||
@ -56,6 +67,10 @@ namespace dxvk {
|
|||||||
return m_handle != nullptr;
|
return m_handle != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_priority(ThreadPriority priority) {
|
||||||
|
::SetThreadPriority(m_handle, int32_t(priority));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Proc m_proc;
|
Proc m_proc;
|
||||||
@ -107,6 +122,10 @@ namespace dxvk {
|
|||||||
&& m_thread->joinable();
|
&& m_thread->joinable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_priority(ThreadPriority priority) {
|
||||||
|
m_thread->set_priority(priority);
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t hardware_concurrency() {
|
static uint32_t hardware_concurrency() {
|
||||||
SYSTEM_INFO info = { };
|
SYSTEM_INFO info = { };
|
||||||
::GetSystemInfo(&info);
|
::GetSystemInfo(&info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user