Seastar
High performance C++ framework for concurrent servers
|
Template helper to auto-stop obj
when destroyed.
Object | a 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.
#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_stop & | operator= (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 |
|
inlinenoexcept |
Construct an object that will auto-stop obj
when destroyed.
obj | the object to auto-stop. |
|
inlinenoexcept |
Moves the deferred_stop
into a new one, and the old one is canceled.
|
inlinenoexcept |
Prevents stop() from being called when this object is destroyed. Cannot call stop_now() any more after this.
|
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.