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

Specialization of shared_future for void type. More...

#include <coopsync_tbb/future.hpp>

Public Member Functions

 shared_future () noexcept=default
 Constructs the shared_future in a not valid state.
 shared_future (const shared_future &other) noexcept=default
 Copy-constructs the shared_future, after copying both objects refer to the same shared state.
shared_future & operator= (const shared_future &other) noexcept=default
 Copy-assigns the shared_future, after assignment both objects refer to the same shared state.
 shared_future (shared_future &&other) noexcept=default
 Move-constructs the shared_future, after moving the current object refers to the shared state of the moved-from object and the moved-from object is left in not valid state.
shared_future & operator= (shared_future &&other) noexcept=default
 Move-assigns the shared_future, after moving the current object refers to the shared state of the moved-from object and the moved-from object is left in not valid state.
 ~shared_future ()=default
 Destroys the shared_future. If it was the last shared_future referring to the shared state, the shared state is released.
bool valid () const noexcept
 Tests whether the shared_future is valid and refers to a shared state.
bool try_wait () const
 Checks whether the shared state is ready without suspending.
void wait () const
 Suspends the current task until the shared state is ready. If the shared state is ready this function returns immediately.
void get () const
 Waits for readiness and checks for exception/broken promise. If the shared state is ready, this function returns immediately. Otherwise, the task is suspended until the state becomes ready. This function can be called multiple times without invalidating the shared state.

Friends

template<typename U>
class future

Detailed Description

Specialization of shared_future for void type.

Constructor & Destructor Documentation

◆ shared_future() [1/2]

coopsync_tbb::shared_future< void >::shared_future ( const shared_future< void > & other)
defaultnoexcept

Copy-constructs the shared_future, after copying both objects refer to the same shared state.

Parameters
otherThe shared_future to copy from.

◆ shared_future() [2/2]

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

Move-constructs the shared_future, after moving the current object refers to the shared state of the moved-from object and the moved-from object is left in not valid state.

Parameters
otherThe shared_future to move from.

Member Function Documentation

◆ get()

void coopsync_tbb::shared_future< void >::get ( ) const
inline

Waits for readiness and checks for exception/broken promise. If the shared state is ready, this function returns immediately. Otherwise, the task is suspended until the state becomes ready. This function can be called multiple times without invalidating the shared state.

Exceptions
future_errorif the future is not valid or if the promise was broken.
Anyexception stored in the shared state.

◆ operator=() [1/2]

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

Copy-assigns the shared_future, after assignment both objects refer to the same shared state.

Parameters
otherThe shared_future to copy from.

◆ operator=() [2/2]

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

Move-assigns the shared_future, after moving the current object refers to the shared state of the moved-from object and the moved-from object is left in not valid state.

Parameters
otherThe shared_future to move from.

◆ try_wait()

bool coopsync_tbb::shared_future< void >::try_wait ( ) const
inline

Checks whether the shared state is ready without suspending.

Returns
true if the shared state is ready, false otherwise.
Exceptions
future_errorwith std::future_errc::no_state if not valid.

◆ valid()

bool coopsync_tbb::shared_future< void >::valid ( ) const
inlinenoexcept

Tests whether the shared_future is valid and refers to a shared state.

Returns
true if the shared_future is valid, false otherwise.

◆ wait()

void coopsync_tbb::shared_future< void >::wait ( ) const
inline

Suspends the current task until the shared state is ready. If the shared state is ready this function returns immediately.

Exceptions
future_errorwith std::future_errc::no_state if the future is not valid.

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