Function realtime_tools::set_thread_affinity(NATIVE_THREAD_HANDLE, const std::vector<int>&)

Function Documentation

std::pair<bool, std::string> realtime_tools::set_thread_affinity(NATIVE_THREAD_HANDLE thread, const std::vector<int> &cores)

Configure the caller thread affinity - Tell the scheduler to prefer a certain set of cores 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 numbers of the core. If an empty vector 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