AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
aui::impl::future::Future< Value > Class Template Reference

Constructor & Destructor Documentation

◆ Future()

template<typename Value = void>
aui::impl::future::Future< Value >::Future ( TaskCallback task = nullptr)
inline
Parameters
taska callback which will be executed by Future::Inner::tryExecute. Can be null. If null, the result should be provided by AFuture::supplyValue function.

Member Function Documentation

> All members, including inherited

◆ cancel()

template<typename Value = void>
void aui::impl::future::Future< Value >::cancel ( ) const
inlinenoexcept

When cancel() is called, there are 3 possible cases:

  1. AFuture's task is not taken by AThreadPool. The task is simply removed from the AThreadPool queue.
  2. AFuture's task is being executed. The task's thread is requested for interrupt.
  3. AFuture's task is already completed. cancel() does nothing.

◆ get()

template<typename Value = void>
FutureReturnType< Value >::type aui::impl::future::Future< Value >::get ( AFutureWait flags = AFutureWait::DEFAULT) const
inline
Sneaky exceptions
AInvoсationTargetException thrown if invocation target has thrown an exception.
Returns
the object stored from the another thread.

◆ hasResult()

template<typename Value = void>
bool aui::impl::future::Future< Value >::hasResult ( ) const
inlinenodiscardnoexcept
Returns
true if the value or exception or interruption was received.

◆ hasValue()

template<typename Value = void>
bool aui::impl::future::Future< Value >::hasValue ( ) const
inlinenodiscardnoexcept
Returns
true if asynchronous operation was successfuly completed and supplied a value, which can be obtained without waiting.

◆ isWaitNeeded()

template<typename Value = void>
bool aui::impl::future::Future< Value >::isWaitNeeded ( ) const
inlinenodiscardnoexcept
Returns
true if call to wait() function would cause thread block.

◆ operator*() [1/2]

template<typename Value = void>
FutureReturnType< Value >::type aui::impl::future::Future< Value >::operator* ( )
inline
Sneaky exceptions
AInvoсationTargetException thrown if invocation target has thrown an exception.
Returns
the object stored from the another thread.

◆ operator*() [2/2]

template<typename Value = void>
FutureReturnType< Value >::type aui::impl::future::Future< Value >::operator* ( ) const
inline
Sneaky exceptions
AInvoсationTargetException thrown if invocation target has thrown an exception.
Returns
the object stored from the another thread.

◆ operator->()

template<typename Value = void>
Value * aui::impl::future::Future< Value >::operator-> ( ) const
inline
Sneaky exceptions
AInvoсationTargetException thrown if invocation target has thrown an exception.
Returns
the object stored from the another thread.

◆ wait()

template<typename Value = void>
void aui::impl::future::Future< Value >::wait ( AFutureWait flags = AFutureWait::DEFAULT) const
inline
Note
The task will be executed inside wait() function if the threadpool have not taken the task to execute yet. This behaviour can be disabled by AFutureWait::JUST_WAIT flag.