Function realtime_tools::set_thread_affinity(pthread_t, int)

Function Documentation

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

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

Note

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

Parameters:
  • thread[in] the thread handle 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