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

Detailed Description

template<>
class seastar::promise< void >

Specialization of promise<void>

This is an alias for promise<>, for generic programming purposes. For example, You may have a promise<T> where T can legally be void.

#include <seastar/core/future.hh>

Inheritance diagram for seastar::promise< void >:
seastar::promise<>

Public Member Functions

future< T... > get_future () noexcept
 Gets the promise's associated future. More...
 
void set_value (A &&... a)
 Sets the promises value. More...
 
void set_exception (std::exception_ptr &&ex) noexcept
 Marks the promise as failed. More...
 
void set_exception (const std::exception_ptr &ex) noexcept
 
std::enable_if_t<!std::is_same< std::remove_reference_t< Exception >, std::exception_ptr >::value, void > set_exception (Exception &&e) noexcept
 Marks the promise as failed. More...
 

Member Function Documentation

◆ get_future()

future< T... > seastar::promise< T >::get_future ( )
inlinenoexceptinherited

Gets the promise's associated future.

The future and promise will be remember each other, even if either or both are moved. When set_value() or set_exception() are called on the promise, the future will be become ready, and if a continuation was attached to the future, it will run.

◆ set_exception() [1/2]

void seastar::promise< T >::set_exception ( std::exception_ptr &&  ex)
inlinenoexceptinherited

Marks the promise as failed.

Forwards the exception argument to the future and makes it available. May be called either before or after get_future().

◆ set_exception() [2/2]

std::enable_if_t<!std::is_same<std::remove_reference_t<Exception>, std::exception_ptr>::value, void> seastar::promise< T >::set_exception ( Exception &&  e)
inlinenoexceptinherited

Marks the promise as failed.

Forwards the exception argument to the future and makes it available. May be called either before or after get_future().

◆ set_value()

void seastar::promise< T >::set_value ( A &&...  a)
inlineinherited

Sets the promises value.

Forwards the arguments and makes them available to the associated future. May be called either before or after get_future().

The arguments can have either the types the promise is templated with, or a corresponding std::tuple. That is, given a promise<int, double>, both calls are valid:

pr.set_value(42, 43.0); pr.set_value(std::tuple<int, double>(42, 43.0))


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