1 #ifndef LIMESUITE_THREAD_H 2 #define LIMESUITE_THREAD_H 3 4 #include <thread> 5 6 namespace lime{ 7 8 enum ThreadPriority { 9 LOWEST, 10 LOW, 11 BELOW_NORMAL, 12 NORMAL, 13 ABOVE_NORMAL, 14 HIGH, 15 HIGHEST 16 }; 17 18 enum ThreadPolicy { 19 DEFAULT, 20 REALTIME, 21 PREEMPTIVE, // FIFO 22 }; 23 /** 24 * Set priority of current or specificied thread 25 * 26 * @param priority Thread priority 27 * @param policy Thread scheduling policy, not used on Windows 28 * @param thread Thread to which set the priority to 29 * 30 * @return 0 on success, (-1) on failure 31 */ 32 int SetOSThreadPriority(ThreadPriority priority, ThreadPolicy policy, std::thread *thread); 33 34 /** 35 * Set priority of current or specificied thread 36 * @note On Windows systems, policy will be used to set either IDLE or TIME_CRITICAL thread priority 37 * 38 * @param priority Thread priority 39 * @param policy Thread scheduling policy, not used on Windows 40 * 41 * @return 0 on success, (-1) on failure 42 */ 43 int SetOSCurrentThreadPriority(ThreadPriority priority, ThreadPolicy policy); 44 } 45 46 #endif 47