84 :
is_running_(other.is_running_.load(std::memory_order_acquire))
85 ,
stop_initiated_(other.stop_initiated_.load(std::memory_order_acquire))
89 other.is_running_.store(
false, std::memory_order_release);
90 other.stop_initiated_.store(
false, std::memory_order_release);
97 is_running_.store(other.is_running_.load(std::memory_order_acquire),
98 std::memory_order_release);
99 stop_initiated_.store(other.stop_initiated_.load(std::memory_order_acquire),
100 std::memory_order_release);
104 other.is_running_.store(
false, std::memory_order_release);
105 other.stop_initiated_.store(
false, std::memory_order_release);
116 return is_running_.load(std::memory_order_acquire);
128 bool expected =
false;
130 expected,
true, std::memory_order_acq_rel);
141 is_running_.store(
true, std::memory_order_release);
154 is_running_.store(
false, std::memory_order_release);
189 bool expected =
false;
191 std::memory_order_acq_rel))
216 is_running_.store(
false, std::memory_order_release);
Thread-safe lifecycle state management for network components.
lifecycle_manager(const lifecycle_manager &)=delete
std::optional< std::promise< void > > stop_promise_
auto try_start() -> bool
Attempts to transition from stopped to running state.
auto reset() -> void
Resets the lifecycle manager to initial state.
lifecycle_manager & operator=(lifecycle_manager &&other) noexcept
auto prepare_stop() -> bool
Prepares for stop operation.
std::future< void > stop_future_
~lifecycle_manager()=default
Destructor.
std::atomic< bool > is_running_
lifecycle_manager()=default
Default constructor.
auto mark_stopped() -> void
Marks the component as stopped and signals waiters.
auto is_running() const -> bool
Checks if the component is currently running.
std::atomic< bool > stop_initiated_
auto wait_for_stop() -> void
Blocks until the component has stopped.
lifecycle_manager & operator=(const lifecycle_manager &)=delete
auto set_running() -> void
Marks the component as running.
lifecycle_manager(lifecycle_manager &&other) noexcept
Utility components for network_system.