27 #ifndef RL_UTIL_THREAD_H
28 #define RL_UTIL_THREAD_H
36 #include <system_error>
47 return ::GetThreadPriority(::GetCurrentThread());
52 if (-1 == ::pthread_getschedparam(::pthread_self(), &policy, ¶m))
54 throw ::std::system_error(::std::error_code(errno, ::std::generic_category()));
57 return param.sched_priority;
64 return THREAD_PRIORITY_TIME_CRITICAL;
66 return ::sched_get_priority_max(SCHED_FIFO);
73 return THREAD_PRIORITY_IDLE;
75 return ::sched_get_priority_min(SCHED_FIFO);
82 if (!::SetThreadPriority(::GetCurrentThread(), priority))
84 throw ::std::system_error(::std::error_code(::GetLastError(), ::std::generic_category()));
88 param.sched_priority = priority;
90 if (-1 == ::pthread_setschedparam(::pthread_self(), SCHED_FIFO, ¶m))
92 throw ::std::system_error(::std::error_code(errno, ::std::generic_category()));
100 #endif // RL_UTIL_THREAD_H