|
ThreadSchedule 2.2.0
Modern C++ thread management library
|
RAII controller that periodically perturbs scheduling attributes of registered threads for chaos/fuzz testing. More...
#include <chaos.hpp>
Public Member Functions | |
| template<typename Predicate> | |
| ChaosController (ChaosConfig cfg, Predicate pred) | |
| ~ChaosController () | |
| ChaosController (ChaosController const &)=delete | |
| auto | operator= (ChaosController const &) -> ChaosController &=delete |
| auto | thread_info () const -> std::optional< ThreadInfo > |
| auto | configure_thread (std::string const &name, SchedulingPolicy policy=SchedulingPolicy::OTHER, ThreadPriority priority=ThreadPriority::normal()) -> expected< void, std::error_code > |
RAII controller that periodically perturbs scheduling attributes of registered threads for chaos/fuzz testing.
On construction, ChaosController spawns a background control thread that wakes every ChaosConfig::interval and applies perturbations (affinity shuffling, priority jitter) to threads in the global registry() that match the user-supplied predicate.
Ownership semantics:
Thread safety: The controller operates on the global registry(), which is internally synchronized, so multiple controllers or concurrent registrations are safe.
|
inline |
Definition at line 90 of file chaos.hpp.
References threadschedule::ThreadInfo::get_thread_id(), and threadschedule::ThreadInfo::set_name().
Referenced by ChaosController(), and operator=().
|
inline |
|
delete |
References ChaosController().
|
inline |
Definition at line 121 of file chaos.hpp.
References threadschedule::detail::configure_thread(), threadschedule::ThreadPriority::normal(), threadschedule::OTHER, and thread_info().
|
delete |
References ChaosController().
|
inlinenodiscard |
Definition at line 114 of file chaos.hpp.
Referenced by configure_thread().