RSC
0.16.0
|
Class providing access to the result of a process that is asynchronously running. More...
#include <Future.h>
Public Member Functions | |
Future () | |
Create a new Future object that does not have a result and is thus suitable for representing an in-progress computation. More... | |
R | get () |
Try to obtain and then return the result of the operation represented by the Future object. More... | |
R | get (double timeout) |
Try to obtain and then return the result of the operation represented by the Future object. More... | |
bool | isDone () |
Tells whether the computation of the underlying process finished and provided a result or generated an error. More... | |
void | set (R data) |
Provide the result for this future. More... | |
void | setError (const std::string &message) |
Indicate an error while processing. More... | |
Protected Types | |
typedef boost::mutex | MutexType |
typedef boost::condition | ConditionType |
Protected Member Functions | |
MutexType & | getMutex () |
ConditionType & | getCondition () |
Private Attributes | |
R | result |
bool | taskFinished |
bool | taskError |
std::string | errorMsg |
ConditionType | condition |
MutexType | mutex |
Class providing access to the result of a process that is asynchronously running.
If the result is requested before the task finished, the ::get operation will block until a results or error is available.
R | result type, should be copyable but this is not a hard requirement |
|
protected |
|
protected |
|
inline |
|
inline |
Try to obtain and then return the result of the operation represented by the Future object.
If necessary, this method waits for the operation to complete, and then retrieves its result.
FutureTaskExecutionException | If the operation represented by the Future object failed. |
|
inline |
Try to obtain and then return the result of the operation represented by the Future object.
If necessary, this method waits up to timeout seconds for the operation to complete. If the operation does not complete within this time a FutureTimeoutException is thrown.
timeout | The amount of time in seconds in which the operation has to complete. |
FutureTaskExecutionException | If the operation represented by the Future object failed. |
FutureTimeoutException | If the result does not become available within the amount of time specified via timeout. |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |