11ExecutionPriority get_execution_priority()
14 int pp = GetPriorityClass(GetCurrentProcess());
15 int tp = GetThreadPriority(GetCurrentThread());
17 if (pp == NORMAL_PRIORITY_CLASS && tp == THREAD_PRIORITY_NORMAL)
20 if (pp == IDLE_PRIORITY_CLASS && tp == THREAD_PRIORITY_IDLE)
23 if (pp == REALTIME_PRIORITY_CLASS && tp == THREAD_PRIORITY_TIME_CRITICAL)
31bool set_execution_priority(ExecutionPriority p)
36 if (!SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS)) {
37 std::cerr <<
"could not set idle process priority" << std::endl;
40 if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE)) {
41 std::cerr <<
"could not set idle thread priority" << std::endl;
46 if (!SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS)) {
47 std::cerr <<
"could not set normal process priority" << std::endl;
50 if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL)) {
51 std::cerr <<
"could not set normal thread priority" << std::endl;
56 if (!SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)) {
57 std::cerr <<
"could not set realtime process priority" << std::endl;
60 if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) {
61 std::cerr <<
"could not set time critical thread priority" << std::endl;
68 std::cerr <<
"set_execution_priority not implemented" << std::endl;