10 #ifndef JB_DEFAULT_thread_config_scheduler 11 #define JB_DEFAULT_thread_config_scheduler "OTHER" 12 #endif // JB_DEFAULT_thread_config_scheduler 14 #ifndef JB_DEFAULT_thread_config_priority 15 #define JB_DEFAULT_thread_config_priority "MIN" 16 #endif // JB_DEFAULT_thread_config_priority 18 #ifndef JB_DEFAULT_ignore_setup_errors 19 #define JB_DEFAULT_ignore_setup_errors true 20 #endif // JB_DEFAULT_ignore_setup_errors 30 : name(desc(
"name").help(
"The name of this thread"), this)
32 desc(
"scheduler").help(
"The scheduling policy for this thread"), this,
36 .help(
"The priority for this thread. " 37 "Use MIN/MID/MAX for the minimum, midpoint and maximum " 39 "in the scheduling class. " 40 "Use a number to set the specific priority"),
43 desc(
"affinity",
"cpu_set")
44 .help(
"The CPU affinity for this thread. " 45 "If none is set, the thread keeps its default affinity " 49 desc(
"ignore-setup-errors")
50 .help(
"Ignore errors changing thread parameters."),
70 std::string msg(
"Unknown scheduling policy: ");
72 throw std::runtime_error(msg);
78 return sched_get_priority_min(policy);
81 return sched_get_priority_max(policy);
84 return (sched_get_priority_max(policy) + sched_get_priority_min(policy)) /
91 std::string msg(
"Invalid scheduling priority: ");
93 throw std::runtime_error(msg);
Define defaults for program parameters.
int native_priority() const
#define JB_DEFAULT_thread_config_scheduler
thread_config()
Constructor.
#define JB_DEFAULT_thread_config_priority
std::string thread_config_priority
std::string thread_config_scheduler
int native_scheduling_policy() const
bool strtonum(std::string const &s, T &r)
Generic string to number conversion with validation.
jb::config_attribute< thread_config, std::string > scheduler
#define JB_DEFAULT_ignore_setup_errors
jb::config_attribute< thread_config, std::string > priority
The top-level namespace for the JayBeams library.