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

Specialization of future for void type. More...

#include <coopsync_tbb/future.hpp>

Public Member Functions

 future () noexcept=default
 Constructs a new future. After construction the future has no shared state and is not valid.
 future (const future &)=delete
 The future is not copy-constructible.
future & operator= (const future &)=delete
 The future is not copy-assignable.
 future (future &&other) noexcept=default
 The future is move-constructible.
future & operator= (future &&other) noexcept=default
 The future is move-assignable.
 ~future ()=default
 Destroys the future releasing any shared state.
bool valid () const noexcept
 Tests whether the 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.
void get ()
 Waits for readiness and consumes the shared state. If the shared state is ready, this function returns immediately. Otherwise, the task is suspended until the state becomes ready. After this call the future is left in not valid state.
shared_future< void > share ()
 Converts this future into a shared_future. After this call, the current future is left in not valid state.

Friends

class promise< void >
template<typename>
class packaged_task
class promise< T >

Detailed Description

Specialization of future for void type.

Constructor & Destructor Documentation

◆ future()

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

The future is move-constructible.

Parameters
otherThe future to move from, after construction has no shared state and is not valid.

Member Function Documentation

◆ get()

void coopsync_tbb::future< void >::get ( )
inline

Waits for readiness and consumes the shared state. If the shared state is ready, this function returns immediately. Otherwise, the task is suspended until the state becomes ready. After this call the future is left in not valid state.

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

◆ operator=()

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

The future is move-assignable.

Parameters
otherThe future to move from, after assignment has no shared state and is not valid.

◆ share()

shared_future< void > coopsync_tbb::future< void >::share ( )
inlinenodiscard

Converts this future into a shared_future. After this call, the current future is left in not valid state.

Returns
A shared_future referring to the same shared state.
Exceptions
future_errorwith std::future_errc::no_state if the future is not valid.

◆ try_wait()

bool coopsync_tbb::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 the future is not valid.

◆ valid()

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

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

Returns
true if the future is valid, false otherwise.

◆ wait()

void coopsync_tbb::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: