Как установить (узнать) приоритет потока ?
{
HANDLE threadHandle = GetCurrentThread();
if (!SetThreadPriority(threadHandle, THREAD_PRIORITY_HIGHEST))
RET_ERR("SetThreadPriority");
int priority = GetThreadPriority(threadHandle);
if (priority == THREAD_PRIORITY_ERROR_RETURN)
RET_ERR("GetThreadPriority");
switch (priority)
{
case THREAD_PRIORITY_ABOVE_NORMAL:
ADD_STR("THREAD_PRIORITY_ABOVE_NORMAL\r\n");
break;
case THREAD_PRIORITY_BELOW_NORMAL:
ADD_STR("THREAD_PRIORITY_BELOW_NORMAL\r\n");
break;
case THREAD_PRIORITY_HIGHEST:
ADD_STR("THREAD_PRIORITY_HIGHEST\r\n");
break;
case THREAD_PRIORITY_IDLE:
ADD_STR("THREAD_PRIORITY_IDLE\r\n");
break;
case THREAD_PRIORITY_LOWEST:
ADD_STR("THREAD_PRIORITY_LOWEST\r\n");
break;
case THREAD_PRIORITY_NORMAL:
ADD_STR("THREAD_PRIORITY_NORMAL\r\n");
break;
case THREAD_PRIORITY_TIME_CRITICAL:
ADD_STR("THREAD_PRIORITY_TIME_CRITICAL\r\n");
break;
default:
ADD_STR("Unknown\r\n");
}
return result_buffer;
}
|