31 #include <boost/shared_ptr.hpp> 32 #include <boost/format.hpp> 33 #include <boost/thread/mutex.hpp> 34 #include <boost/thread/condition.hpp> 36 #include "rsc/rscexports.h" 117 taskFinished(false), taskError(false) {
153 R
get(
double timeout) {
154 MutexType::scoped_lock lock(mutex);
155 while (!taskFinished) {
157 condition.wait(lock);
159 #if BOOST_VERSION >= 105000 160 if (!condition.timed_wait(lock, boost::posix_time::microseconds(
long(timeout) * 1000000))) {
163 boost::xtime_get(&xt, boost::TIME_UTC);
165 if (!condition.timed_wait(lock, xt)) {
170 "Timeout while waiting for result. Waited %1% seconds.")
191 MutexType::scoped_lock lock(mutex);
203 MutexType::scoped_lock lock(mutex);
205 condition.notify_all();
217 MutexType::scoped_lock lock(mutex);
221 condition.notify_all();
229 return this->condition;
Thrown when the execution of a Future's task does not complete within the specified amount of time...
bool isDone()
Tells whether the computation of the underlying process finished and provided a result or generated a...
boost::condition ConditionType
Thrown when the result of the computation represented by a future is not available for some reason...
ConditionType & getCondition()
Class providing access to the result of a process that is asynchronously running. ...
Exception that is thrown if the result of a Future is not available because the underlying process ge...
void setError(const std::string &message)
Indicate an error while processing.
Future()
Create a new Future object that does not have a result and is thus suitable for representing an in-pr...