Attempting a thread priority mapping.

This commit is contained in:
Ben Vanik 2015-05-17 21:26:27 -07:00
parent 56e27990e0
commit 4d32c7af05
1 changed files with 13 additions and 1 deletions

View File

@ -520,7 +520,19 @@ void XThread::RundownAPCs() {
int32_t XThread::QueryPriority() { return GetThreadPriority(thread_handle_); }
void XThread::SetPriority(int32_t increment) {
SetThreadPriority(thread_handle_, increment);
int target_priority = 0;
if (increment > 0x11) {
target_priority = THREAD_PRIORITY_HIGHEST;
} else if (increment > 0) {
target_priority = THREAD_PRIORITY_ABOVE_NORMAL;
} else if (increment < -0x22) {
target_priority = THREAD_PRIORITY_IDLE;
} else if (increment < -0x11) {
target_priority = THREAD_PRIORITY_LOWEST;
} else {
target_priority = THREAD_PRIORITY_NORMAL;
}
SetThreadPriority(thread_handle_, target_priority);
}
void XThread::SetAffinity(uint32_t affinity) {