ThreadSchedule 3.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
native.hpp File Reference

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

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

Go to the source code of this file.

Classes

class  threadschedule::detail::native_thread_priority
 Value-semantic wrapper for a thread scheduling priority. More...
 
struct  threadschedule::detail::native_scheduling_config
 
struct  threadschedule::detail::resolved_scheduling
 
class  threadschedule::detail::native_thread_affinity
 Manages a set of CPU indices to which a thread may be bound. More...
 
struct  threadschedule::detail::native_thread_config
 
class  threadschedule::detail::scheduler_parameters
 Static utility class for constructing OS-native scheduling parameters. More...
 

Namespaces

namespace  threadschedule
 
namespace  threadschedule::detail
 Aggregates multiple thread_registry_backend instances into a single queryable view.
 
namespace  threadschedule::detail::native_schedule
 

Typedefs

using threadschedule::detail::native_thread_id = pid_t
 

Enumerations

enum class  threadschedule::detail::native_scheduling_policy : std::uint_fast8_t {
  threadschedule::detail::other = SCHED_OTHER , threadschedule::detail::fifo = SCHED_FIFO , threadschedule::detail::rr = SCHED_RR , threadschedule::detail::batch = SCHED_BATCH ,
  threadschedule::detail::idle = SCHED_IDLE
}
 Enumeration of available thread scheduling policies. More...
 
enum class  threadschedule::detail::native_scheduling_intent : std::uint_fast8_t {
  threadschedule::detail::background , threadschedule::detail::normal , threadschedule::detail::interactive , threadschedule::detail::low_latency ,
  threadschedule::detail::realtime
}
 
enum class  threadschedule::detail::native_priority_model : std::uint_fast8_t {
  threadschedule::detail::intent , threadschedule::detail::posix_nice , threadschedule::detail::posix_realtime , threadschedule::detail::windows_thread ,
  threadschedule::detail::platform_native
}
 

Functions

constexpr auto threadschedule::detail::native_schedule::background () noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::normal () noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::interactive () noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::low_latency () noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::realtime_fifo (int priority=80) noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::realtime_rr (int priority=80) noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::posix_nice (int nice_value) noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::native (native_scheduling_policy policy, native_thread_priority priority) noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::native_schedule::native_windows_priority (int priority) noexcept -> native_scheduling_config
 
constexpr auto threadschedule::detail::is_realtime_policy (native_scheduling_policy policy) noexcept -> bool
 
constexpr auto threadschedule::detail::uses_nice_value (native_scheduling_policy policy) noexcept -> bool
 
constexpr auto threadschedule::detail::resolve_scheduling_config (native_scheduling_config const &config) noexcept -> resolved_scheduling
 
auto threadschedule::detail::to_string (native_scheduling_policy policy) -> std::string
 String conversion utilities.
 
template<typename NativeHandle >
auto threadschedule::detail::apply_affinity_checked (NativeHandle handle, native_thread_affinity const &affinity) -> expected< void, std::error_code >
 
template<typename NativeHandle >
auto threadschedule::detail::apply_scheduling_config (NativeHandle handle, native_thread_id tid, native_scheduling_config const &config) -> expected< void, std::error_code >
 
template<typename NativeHandle >
auto threadschedule::detail::read_effective_nice (NativeHandle handle, native_thread_id tid) -> expected< int, std::error_code >
 

Detailed Description

Scheduling policies, thread priority, and CPU affinity types.

Definition in file native.hpp.