|
libosmscout 1.1.1
|
#include <libosmscout/include/osmscout/async/CancelableFuture.h>
Classes | |
| struct | State |
| class | FutureBreaker |
| class | Promise |
Public Types | |
| using | DoneCallback = std::function<void(T const&)> |
| using | CancelCallback = std::function<void()> |
Public Member Functions | |
| CancelableFuture (const CancelableFuture &)=default | |
| CancelableFuture (CancelableFuture &&)=default | |
| virtual | ~CancelableFuture ()=default |
| CancelableFuture & | operator= (const CancelableFuture &)=default |
| CancelableFuture & | operator= (CancelableFuture &&)=default |
| void | Cancel () |
| void | OnComplete (const DoneCallback &callback) |
| void | OnCancel (const CancelCallback &callback) |
| std::optional< T > | Value () |
| bool | IsCanceled () |
| std::future< T > | StdFuture () |
Future provides mechanism to access result of asynchronous computation. Instead of std::future, this one provides callbacks. So the consumer of the value doesn't need to be blocked.
| T |
| using osmscout::CancelableFuture< T >::CancelCallback = std::function<void()> |
| using osmscout::CancelableFuture< T >::DoneCallback = std::function<void(T const&)> |
|
default |
|
default |
|
virtualdefault |
|
inline |
Cancel the corresponding execution. Cancel callbacks are executed in context of caller.
|
inline |
|
inline |
Callback triggered when future is canceled. It is called from thread that is canceling the execution. When future is completed already, callback is called immediately in thread of caller.
| callback |
|
inline |
Callback triggered on future complete. When future is canceled, it is never called. It is called from thread of value producer. When future is completed already, callback is called immediately in thread of caller.
| callback |
|
default |
|
default |
|
inline |
|
inline |