template class Poco::ActiveResultHolder
Overview
This class holds the result of an asynchronous method invocation. Moreā¦
#include <ActiveResult.h> template <class ResultType> class ActiveResultHolder: public Poco::RefCountedObject { public: // methods ResultType& data(); void data(ResultType* pData); void wait(); bool tryWait(long milliseconds); void wait(long milliseconds); void notify(); bool failed() const; std::string error() const; Exception* exception() const; void error(const Exception& exc); void error(const std::string& msg); };
Inherited Members
public: // methods void duplicate() const; void release() const; int referenceCount() const;
Detailed Documentation
This class holds the result of an asynchronous method invocation.
It is used to pass the result from the execution thread back to the invocation thread. The class uses reference counting for memory management. Do not use this class directly, use ActiveResult instead.
Methods
ResultType& data()
Returns a reference to the actual result.
void wait()
Pauses the caller until the result becomes available.
bool tryWait(long milliseconds)
Waits up to the specified interval for the result to become available.
Returns true if the result became available, false otherwise.
void wait(long milliseconds)
Waits up to the specified interval for the result to become available.
Throws a TimeoutException if the result did not became available.
void notify()
Notifies the invoking thread that the result became available.
bool failed() const
Returns true if the active method failed (and threw an exception).
Information about the exception can be obtained by calling error().
std::string error() const
If the active method threw an exception, a textual representation of the exception is returned.
An empty string is returned if the active method completed successfully.
Exception* exception() const
If the active method threw an exception, a clone of the exception object is returned, otherwise null.
void error(const Exception& exc)
Sets the exception.
void error(const std::string& msg)
Sets the exception.