|
ThreadSchedule 1.0.0
Modern C++ thread management library
|
Owning wrapper around std::thread with RAII join-on-destroy semantics. More...
#include <thread_wrapper.hpp>
Public Member Functions | |
| ThreadWrapper (std::thread &&t) noexcept | |
| template<typename F, typename... Args> | |
| ThreadWrapper (F &&f, Args &&... args) | |
| ThreadWrapper (ThreadWrapper const &)=delete | |
| auto | operator= (ThreadWrapper const &) -> ThreadWrapper &=delete |
| ThreadWrapper (ThreadWrapper &&other) noexcept | |
| auto | operator= (ThreadWrapper &&other) noexcept -> ThreadWrapper & |
| auto | release () noexcept -> std::thread |
| operator std::thread () &&noexcept | |
| Public Member Functions inherited from threadschedule::BaseThreadWrapper< std::thread, detail::OwningTag > | |
| void | join () |
| void | detach () |
| auto | joinable () const noexcept -> bool |
| auto | get_id () const noexcept -> id |
| auto | native_handle () noexcept -> native_handle_type |
| auto | set_name (std::string const &name) -> expected< void, std::error_code > |
| auto | get_name () const -> std::optional< std::string > |
| auto | set_priority (ThreadPriority priority) -> expected< void, std::error_code > |
| auto | set_scheduling_policy (SchedulingPolicy policy, ThreadPriority priority) -> expected< void, std::error_code > |
| auto | set_affinity (ThreadAffinity const &affinity) -> expected< void, std::error_code > |
| auto | get_affinity () const -> std::optional< ThreadAffinity > |
Static Public Member Functions | |
| template<typename F, typename... Args> | |
| static auto | create_with_config (std::string const &name, SchedulingPolicy policy, ThreadPriority priority, F &&f, Args &&... args) -> ThreadWrapper |
| Static Public Member Functions inherited from threadschedule::BaseThreadWrapper< std::thread, detail::OwningTag > | |
| static auto | set_nice_value (int nice_value) -> bool |
| static auto | get_nice_value () -> std::optional< int > |
Additional Inherited Members | |
| Public Types inherited from threadschedule::BaseThreadWrapper< std::thread, detail::OwningTag > | |
| using | native_handle_type |
| using | id |
Owning wrapper around std::thread with RAII join-on-destroy semantics.
Extends BaseThreadWrapper to provide an owning, movable, non-copyable wrapper over std::thread. Adds automatic lifetime management: the destructor joins the thread if it is still joinable, which means destruction can block until the thread finishes.
join() if the thread is joinable. This will block the destroying thread until the managed thread completes. If blocking destruction is undesirable, call detach() or release() before the wrapper goes out of scope.std::thread out of the wrapper, returning it by value. After release, the wrapper holds a default-constructed (non-joinable) thread and destruction becomes a no-op.set_name() or set_scheduling_policy() are silently ignored - the thread will still be running but may not have the requested attributes. Check attributes after construction if they are critical.Definition at line 551 of file thread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 557 of file thread_wrapper.hpp.
|
inlineexplicit |
Definition at line 563 of file thread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 571 of file thread_wrapper.hpp.
|
inlineoverride |
Definition at line 589 of file thread_wrapper.hpp.
|
inlinestatic |
Definition at line 610 of file thread_wrapper.hpp.
|
inlineexplicitnoexcept |
Definition at line 603 of file thread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 576 of file thread_wrapper.hpp.
|
inlinenoexcept |
Definition at line 598 of file thread_wrapper.hpp.