ThreadSchedule 2.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
scheduler_policy.hpp File Reference

Scheduling policies, thread priority, and CPU affinity types. More...

#include "expected.hpp"
#include <algorithm>
#include <cstdint>
#include <optional>
#include <sstream>
#include <string>
#include <system_error>
#include <vector>
#include <pthread.h>
#include <sched.h>
#include <sys/resource.h>
Include dependency graph for scheduler_policy.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  threadschedule::ThreadPriority
 Value-semantic wrapper for a thread scheduling priority. More...
class  threadschedule::ThreadAffinity
 Manages a set of CPU indices to which a thread may be bound. More...
class  threadschedule::SchedulerParams
 Static utility class for constructing OS-native scheduling parameters. More...

Namespaces

namespace  threadschedule
namespace  threadschedule::detail

Enumerations

enum class  threadschedule::SchedulingPolicy : std::uint_fast8_t {
  threadschedule::OTHER = SCHED_OTHER , threadschedule::FIFO = SCHED_FIFO , threadschedule::RR = SCHED_RR , threadschedule::BATCH = SCHED_BATCH ,
  threadschedule::IDLE = SCHED_IDLE
}
 Enumeration of available thread scheduling policies. More...

Functions

auto threadschedule::to_string (SchedulingPolicy policy) -> std::string
 String conversion utilities.
template<typename SetSchedFn>
auto threadschedule::detail::apply_sched_params (SchedulingPolicy policy, ThreadPriority priority, SetSchedFn &&set_sched) -> expected< void, std::error_code >
auto threadschedule::detail::apply_scheduling_policy (pthread_t handle, SchedulingPolicy policy, ThreadPriority priority) -> expected< void, std::error_code >
auto threadschedule::detail::apply_priority (pthread_t handle, ThreadPriority priority) -> expected< void, std::error_code >
auto threadschedule::detail::apply_affinity (pthread_t handle, ThreadAffinity const &affinity) -> expected< void, std::error_code >
auto threadschedule::detail::apply_name (pthread_t handle, std::string const &name) -> expected< void, std::error_code >
auto threadschedule::detail::read_name (pthread_t handle) -> std::optional< std::string >
auto threadschedule::detail::read_affinity (pthread_t handle) -> std::optional< ThreadAffinity >
auto threadschedule::detail::apply_scheduling_policy (pid_t tid, SchedulingPolicy policy, ThreadPriority priority) -> expected< void, std::error_code >
auto threadschedule::detail::apply_priority (pid_t tid, ThreadPriority priority) -> expected< void, std::error_code >
auto threadschedule::detail::apply_affinity (pid_t tid, ThreadAffinity const &affinity) -> expected< void, std::error_code >

Detailed Description

Scheduling policies, thread priority, and CPU affinity types.

Definition in file scheduler_policy.hpp.