Seastar
High performance C++ framework for concurrent servers
Public Member Functions | List of all members
seastar::deferred_stop< Object > Class Template Reference

Detailed Description

template<typename Object>
class seastar::deferred_stop< Object >

Template helper to auto-stop obj when destroyed.

Template Parameters
Objecta class exposing a stop() method that returns a future<> that is called when the controller is destroyed.

Must be used in a seastar thread as the destructor needs to wait on the obj stop() future.

Examples
sharded_parameter_demo.cc.

#include <seastar/util/closeable.hh>

Public Member Functions

 deferred_stop (Object &obj) noexcept
 
 deferred_stop (deferred_stop &&x) noexcept
 
 deferred_stop (const deferred_stop &)=delete
 
deferred_stopoperator= (deferred_stop &&x) noexcept
 
 ~deferred_stop ()
 Destruct the deferred_stop object and auto-stop obj.
 
void stop_now () noexcept
 Stop obj once now.
 
void cancel () noexcept
 

Constructor & Destructor Documentation

◆ deferred_stop() [1/2]

template<typename Object >
seastar::deferred_stop< Object >::deferred_stop ( Object &  obj)
inlinenoexcept

Construct an object that will auto-stop obj when destroyed.

Template Parameters
objthe object to auto-stop.

◆ deferred_stop() [2/2]

template<typename Object >
seastar::deferred_stop< Object >::deferred_stop ( deferred_stop< Object > &&  x)
inlinenoexcept

Moves the deferred_stop into a new one, and the old one is canceled.

Member Function Documentation

◆ cancel()

template<typename Object >
void seastar::deferred_stop< Object >::cancel ( )
inlinenoexcept

Prevents stop() from being called when this object is destroyed. Cannot call stop_now() any more after this.

◆ operator=()

template<typename Object >
deferred_stop& seastar::deferred_stop< Object >::operator= ( deferred_stop< Object > &&  x)
inlinenoexcept

Move-assign another deferred_stop. The current deferred_stop is stopped before being assigned. And the other one's state is transferred to the current one.


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