CoopSync for TBB 0.1.0
Cooperative synchronization primitives for TBB resumable tasks
Loading...
Searching...
No Matches
coopsync_tbb::promise< void > Class Reference

Specialization of promise for void type. The promise<void> does not store a value, but only the state of readiness and any exception. More...

#include <coopsync_tbb/future.hpp>

Public Member Functions

 promise ()=default
 Constructs a new promise with an empty shared state.
template<typename Alloc>
 promise (const Alloc &alloc)
 Constructs a new promise using the given allocator.
 promise (const promise &)=delete
 The promise is not copy-constructible.
promise & operator= (const promise &)=delete
 The promise is not copy-assignable.
 promise (promise &&other) noexcept=default
 The promise is move-constructible.
promise & operator= (promise &&other) noexcept=default
 The promise is move-assignable.
 ~promise ()=default
 Destroys the promise. If the shared state is not ready, it is marked as broken.
void swap (promise &other) noexcept
 Exchanges the shared states between two promises.
future< void > get_future ()
 Returns a future associated with the shared state.
void set_value ()
 Marks the shared state as ready without storing a value.
void set_exception (std::exception_ptr p)
 Stores an exception into the shared state and makes it ready.

Detailed Description

Specialization of promise for void type. The promise<void> does not store a value, but only the state of readiness and any exception.

Constructor & Destructor Documentation

◆ promise() [1/2]

template<typename Alloc>
coopsync_tbb::promise< void >::promise ( const Alloc & alloc)
inlineexplicit

Constructs a new promise using the given allocator.

Parameters
allocAllocator used to allocate the shared state.

◆ promise() [2/2]

coopsync_tbb::promise< void >::promise ( promise< void > && other)
defaultnoexcept

The promise is move-constructible.

Parameters
otherThe promise to move from, after construction has empty shared state.

Member Function Documentation

◆ get_future()

future< void > coopsync_tbb::promise< void >::get_future ( )
inlinenodiscard

Returns a future associated with the shared state.

Exceptions
future_errorwith std::future_errc::no_state if the promise is not valid.
future_errorwith std::future_errc::future_already_retrieved if the future was already retrieved.

◆ operator=()

promise & coopsync_tbb::promise< void >::operator= ( promise< void > && other)
defaultnoexcept

The promise is move-assignable.

Parameters
otherThe promise to move from, after assignment has empty shared state.

◆ set_exception()

void coopsync_tbb::promise< void >::set_exception ( std::exception_ptr p)
inline

Stores an exception into the shared state and makes it ready.

Parameters
pThe exception to store in the shared state.
Exceptions
future_errorwith std::future_errc::no_state if the promise is not valid.

◆ set_value()

void coopsync_tbb::promise< void >::set_value ( )
inline

Marks the shared state as ready without storing a value.

Exceptions
future_errorwith std::future_errc::no_state if the promise is not valid.
future_errorwith std::future_errc::promise_already_satisfied if the shared state already stores a value or an exception.

◆ swap()

void coopsync_tbb::promise< void >::swap ( promise< void > & other)
inlinenoexcept

Exchanges the shared states between two promises.

Parameters
otherThe promise to exchange shared state with.

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