MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / try_os_thread_priority

Function try_os_thread_priority

tests/BS_thread_pool_test.cpp:3100–3110  ·  view source on GitHub ↗

* @brief Try to set the OS priority of this thread to the highest possible value. Also set the name of the thread for debugging purposes. */

Source from the content-addressed store, hash-verified

3098 * @brief Try to set the OS priority of this thread to the highest possible value. Also set the name of the thread for debugging purposes.
3099 */
3100void try_os_thread_priority()
3101{
3102 if (!BS::this_thread::set_os_thread_priority(BS::os_thread_priority::realtime))
3103 if (!BS::this_thread::set_os_thread_priority(BS::os_thread_priority::highest))
3104 BS::this_thread::set_os_thread_priority(BS::os_thread_priority::above_normal);
3105 std::optional<std::size_t> idx = BS::this_thread::get_index();
3106 if (idx.has_value())
3107 BS::this_thread::set_os_thread_name(make_string("Benchmark #", *idx));
3108 else
3109 BS::this_thread::set_os_thread_name("Benchmark main");
3110}
3111#endif
3112
3113// ========================

Callers 1

check_performanceFunction · 0.85

Calls 1

make_stringFunction · 0.85

Tested by

no test coverage detected