|  | Home | Libraries | People | FAQ | More | 
          A promise<> provides a mechanism to store a value (or
          exception) that can later be retrieved from the corresponding future<> object.
          promise<>
          and future<>
          communicate via their underlying shared state.
        
#include <boost/fiber/future/promise.hpp> namespace boost { namespace fibers { template< typename R > class promise { public: promise(); template< typenameAllocator> promise(std::allocator_arg_t, Allocator); promise( promise &&) noexcept; promise & operator=( promise &&) noexcept; promise( promise const&) = delete; promise & operator=( promise const&) = delete; ~promise(); void swap( promise &) noexcept; future< R > get_future(); void set_value( R const&); // member only of generic promise template void set_value( R &&); // member only of generic promise template void set_value( R &); // member only of promise< R & > template void set_value(); // member only of promise< void > template void set_exception( std::exception_ptr p); }; template< typename R > void swap( promise< R > &, promise< R > &) noexcept; }
promise();
Creates a promise with an empty shared state.
Exceptions caused by memory allocation.
template< typenameAllocator> promise(std::allocator_arg_t, Allocator alloc);
                Creates a promise with an empty shared
                state by using alloc.
              
Exceptions caused by memory allocation.
promise( promise && other) noexcept;
                Creates a promise by moving the shared
                state from other.
              
                other contains no
                valid shared state.
              
Nothing.
~promise();
                Destroys *this
                and abandons the shared state
                if shared state is ready; otherwise stores future_error
                with error condition future_errc::broken_promise
                as if by promise::set_exception(): the shared
                state is set ready.
              
operator=()
promise & operator=( promise && other) noexcept;
                Transfers the ownership of shared state
                to *this.
              
                other contains no
                valid shared state.
              
Nothing.
swap()
void swap( promise & other) noexcept;
                Swaps the shared state between
                other and *this.
              
Nothing.
get_future()
future< R > get_future();
                A future<> with the same shared
                state.
              
                future_error with
                future_errc::future_already_retrieved or future_errc::no_state.
              
set_value()
void set_value( R const& value); // member only of generic promise template void set_value( R && value); // member only of generic promise template void set_value( R & value); // member only of promise< R & > template void set_value(); // member only of promise< void > template
Store the result in the shared state and marks the state as ready.
                future_error with
                future_errc::future_already_satisfied or future_errc::no_state.
              
set_exception()
void set_exception( std::exception_ptr);
Store an exception pointer in the shared state and marks the state as ready.
                future_error with
                future_errc::future_already_satisfied or future_errc::no_state.
              
swap()
template< typename R > void swap( promise< R > & l, promise< R > & r) noexcept;
                Same as l.swap(
                r).