![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Corresponds to std::future. More...
#include <Future.h>
Public Member Functions | |
| Future ()=default | |
| Future (const Future &o)=delete | |
| Future (Future &&)=default | |
| Future & | operator= (Future &&other) |
| template<typename Callback , typename... Args> | |
| Future (auto &taskManager, Callback &&callback, Args &&... args) | |
| Make the future wait for the result of callback. More... | |
| ~Future () | |
| ResultType | Get () |
| Move the result out of the future, and invalidate the future. More... | |
| bool | IsDone () const |
| bool | Valid () const |
| void | Wait () |
| void | CancelOrWait () |
Protected Attributes | |
| std::shared_ptr< FutureSharedStateDetail::Receiver< ResultType > > | m_Receiver |
Friends | |
| template<typename T > | |
| class | PackagedTask |
Corresponds to std::future.
Unlike std::future, Future can request the cancellation of the task that would produce the result. This makes it more similar to Java's CancellableTask or C#'s Task. The name Future was kept over Task so it would be more familiar to C++ users, but this all should be revised once Concurrency TS wraps up.
Future is not thread-safe. Call it from a single thread or ensure synchronization externally.
The callback never runs after the Future is destroyed.
|
delete |
|
inline |
Make the future wait for the result of callback.
|
inline |
|
inline |
Move the result out of the future, and invalidate the future.
If the future is not complete, calls Wait(). If the future is invalid, asserts.
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |