ThreadSchedule 1.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::PThreadAttributes Class Reference

RAII wrapper for pthread_attr_t with a builder-style API. More...

#include <pthread_wrapper.hpp>

Public Member Functions

 PThreadAttributes (PThreadAttributes const &)=delete
auto operator= (PThreadAttributes const &) -> PThreadAttributes &=delete
 PThreadAttributes (PThreadAttributes &&other) noexcept
auto operator= (PThreadAttributes &&other) noexcept -> PThreadAttributes &
auto get () const -> pthread_attr_t const &
auto get () -> pthread_attr_t &
auto set_detach_state (bool detached) -> bool
auto set_stack_size (size_t stack_size) -> bool
auto set_guard_size (size_t guard_size) -> bool
auto set_scheduling_policy (SchedulingPolicy policy) -> bool
auto set_scheduling_parameter (ThreadPriority priority) -> bool
auto set_inherit_sched (bool inherit) -> bool
auto set_scope (bool system_scope) -> bool
auto get_detach_state () const -> std::optional< bool >
auto get_stack_size () const -> std::optional< size_t >
auto get_guard_size () const -> std::optional< size_t >

Detailed Description

RAII wrapper for pthread_attr_t with a builder-style API.

Non-copyable, movable. The move constructor and move assignment operator call std::terminate if the re-initialisation of the moved-from attribute object fails (cannot throw from noexcept).

The destructor always calls pthread_attr_destroy.

Provides fluent setters for detach state, stack size, guard size, scheduling policy, priority, inherit-sched, and contention scope.

Definition at line 306 of file pthread_wrapper.hpp.

Constructor & Destructor Documentation

◆ PThreadAttributes() [1/2]

threadschedule::PThreadAttributes::PThreadAttributes ( )
inline

Definition at line 309 of file pthread_wrapper.hpp.

◆ ~PThreadAttributes()

threadschedule::PThreadAttributes::~PThreadAttributes ( )
inline

Definition at line 317 of file pthread_wrapper.hpp.

◆ PThreadAttributes() [2/2]

threadschedule::PThreadAttributes::PThreadAttributes ( PThreadAttributes && other)
inlinenoexcept

Definition at line 327 of file pthread_wrapper.hpp.

Member Function Documentation

◆ get() [1/2]

auto threadschedule::PThreadAttributes::get ( ) -> pthread_attr_t&
inline

Definition at line 353 of file pthread_wrapper.hpp.

◆ get() [2/2]

auto threadschedule::PThreadAttributes::get ( ) const -> pthread_attr_t const&
inlinenodiscard

Definition at line 349 of file pthread_wrapper.hpp.

◆ get_detach_state()

auto threadschedule::PThreadAttributes::get_detach_state ( ) const -> std::optional<bool>
inlinenodiscard

Definition at line 401 of file pthread_wrapper.hpp.

◆ get_guard_size()

auto threadschedule::PThreadAttributes::get_guard_size ( ) const -> std::optional<size_t>
inlinenodiscard

Definition at line 421 of file pthread_wrapper.hpp.

◆ get_stack_size()

auto threadschedule::PThreadAttributes::get_stack_size ( ) const -> std::optional<size_t>
inlinenodiscard

Definition at line 411 of file pthread_wrapper.hpp.

◆ operator=()

auto threadschedule::PThreadAttributes::operator= ( PThreadAttributes && other) -> PThreadAttributes&
inlinenoexcept

Definition at line 335 of file pthread_wrapper.hpp.

◆ set_detach_state()

auto threadschedule::PThreadAttributes::set_detach_state ( bool detached) -> bool
inline

Definition at line 359 of file pthread_wrapper.hpp.

◆ set_guard_size()

auto threadschedule::PThreadAttributes::set_guard_size ( size_t guard_size) -> bool
inline

Definition at line 370 of file pthread_wrapper.hpp.

◆ set_inherit_sched()

auto threadschedule::PThreadAttributes::set_inherit_sched ( bool inherit) -> bool
inline

Definition at line 388 of file pthread_wrapper.hpp.

◆ set_scheduling_parameter()

auto threadschedule::PThreadAttributes::set_scheduling_parameter ( ThreadPriority priority) -> bool
inline

Definition at line 381 of file pthread_wrapper.hpp.

◆ set_scheduling_policy()

auto threadschedule::PThreadAttributes::set_scheduling_policy ( SchedulingPolicy policy) -> bool
inline

Definition at line 375 of file pthread_wrapper.hpp.

◆ set_scope()

auto threadschedule::PThreadAttributes::set_scope ( bool system_scope) -> bool
inline

Definition at line 394 of file pthread_wrapper.hpp.

◆ set_stack_size()

auto threadschedule::PThreadAttributes::set_stack_size ( size_t stack_size) -> bool
inline

Definition at line 365 of file pthread_wrapper.hpp.


The documentation for this class was generated from the following file: