High performance C++ framework for concurrent servers
Classes | Public Member Functions | List of all members
seastar::abort_source Class Reference

Detailed Description

Facility to communicate a cancellation request to a fiber. Callbacks can be registered with the abort_source, which are called atomically with a call to request_abort().

#include <seastar/core/abort_source.hh>


class  subscription

Public Member Functions

optimized_optional< subscriptionsubscribe (subscription_callback_type f) noexcept(std::is_nothrow_move_constructible< subscription_callback_type >::value)
void request_abort () noexcept
bool abort_requested () const noexcept
 Returns whether an abort has been requested.
void check () const
 Throws a abort_requested_exception if cancellation has been requested.

Member Function Documentation

◆ request_abort()

void seastar::abort_source::request_abort ( )

Requests that the target operation be aborted. Current subscriptions are invoked inline with this call, and no new ones can be registered.

◆ subscribe()

optimized_optional<subscription> seastar::abort_source::subscribe ( subscription_callback_type  f)

Delays the invocation of the callback f until request_abort() is called.

an engaged optimized_optional containing a subscription that can be used to control the lifetime of the callback f, if abort_requested() is false. Otherwise, returns a disengaged optimized_optional.

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