Function realtime_tools::set_thread_affinity(std::thread&, int)

Function Documentation

std::pair<bool, std::string> realtime_tools::set_thread_affinity(std::thread &thread, int core)

Configure the caller thread affinity - Tell the scheduler to prefer a certain core for the given thread.

Note

The threads created by the calling thread will inherit the affinity.

Parameters:
  • thread[in] the reference of the thread

  • core[in] the cpu number of the core. If a negative number is passed, the affinity is reset to the default.

Returns:

a pair of a boolean indicating whether the operation succeeded or not and a message describing the result of the operation