|
ThreadSchedule 1.0.0
Modern C++ thread management library
|
RAII wrapper around POSIX threads with a modern C++ interface. More...
#include <pthread_wrapper.hpp>
Public Types | |
| using | native_handle_type = pthread_t |
| using | id = pthread_t |
Public Member Functions | |
| template<typename F, typename... Args> | |
| PThreadWrapper (F &&func, Args &&... args) | |
| PThreadWrapper (PThreadWrapper const &)=delete | |
| auto | operator= (PThreadWrapper const &) -> PThreadWrapper &=delete |
| PThreadWrapper (PThreadWrapper &&other) noexcept | |
| auto | operator= (PThreadWrapper &&other) noexcept -> PThreadWrapper & |
| void | join () |
| void | detach () |
| auto | joinable () const -> bool |
| auto | get_id () const -> id |
| auto | native_handle () const -> native_handle_type |
| auto | set_name (std::string const &name) const -> expected< void, std::error_code > |
| auto | get_name () const -> std::optional< std::string > |
| auto | set_priority (ThreadPriority priority) const -> expected< void, std::error_code > |
| auto | set_scheduling_policy (SchedulingPolicy policy, ThreadPriority priority) const -> expected< void, std::error_code > |
| auto | set_affinity (ThreadAffinity const &affinity) const -> expected< void, std::error_code > |
| auto | get_affinity () const -> std::optional< ThreadAffinity > |
| auto | cancel () const -> expected< void, std::error_code > |
Static Public Member Functions | |
| static auto | set_cancel_state (bool enabled) -> expected< void, std::error_code > |
| static auto | set_cancel_type (bool asynchronous) -> expected< void, std::error_code > |
| template<typename F, typename... Args> | |
| static auto | create_with_config (std::string const &name, SchedulingPolicy policy, ThreadPriority priority, F &&f, Args &&... args) -> PThreadWrapper |
| template<typename F, typename... Args> | |
| static auto | create_with_attributes (pthread_attr_t const &attr, F &&func, Args &&... args) -> PThreadWrapper |
RAII wrapper around POSIX threads with a modern C++ interface.
Linux-only – not available on Windows (guarded by _WIN32).
Non-copyable, movable. The destructor automatically joins the thread if it is still joinable, which blocks until the thread finishes.
Internally stores the callable in a heap-allocated std::function so that it can be passed through the C pthread_create API.
pthread_setname_np). static and affect the calling thread, not the PThreadWrapper's thread.pthread_attr_t.true_type at end of file) Definition at line 48 of file pthread_wrapper.hpp.
| using threadschedule::PThreadWrapper::id = pthread_t |
Definition at line 52 of file pthread_wrapper.hpp.
| using threadschedule::PThreadWrapper::native_handle_type = pthread_t |
Definition at line 51 of file pthread_wrapper.hpp.
|
inline |
Definition at line 54 of file pthread_wrapper.hpp.
|
inlineexplicit |
Definition at line 59 of file pthread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 79 of file pthread_wrapper.hpp.
|
inline |
Definition at line 101 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 218 of file pthread_wrapper.hpp.
|
inlinestatic |
Definition at line 256 of file pthread_wrapper.hpp.
|
inlinestatic |
Definition at line 245 of file pthread_wrapper.hpp.
|
inline |
Definition at line 123 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 207 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 140 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 159 of file pthread_wrapper.hpp.
|
inline |
Definition at line 110 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 135 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 144 of file pthread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 85 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 200 of file pthread_wrapper.hpp.
|
inlinestatic |
Definition at line 225 of file pthread_wrapper.hpp.
|
inlinestatic |
Definition at line 234 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 150 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 169 of file pthread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 184 of file pthread_wrapper.hpp.