template class Poco::ActiveResult<void>
Overview
This class holds the result of an asynchronous method invocation (see class ActiveMethod). Moreā¦
#include <ActiveResult.h> template <> class ActiveResult<void> { public: // typedefs typedef ActiveResultHolder<void> ActiveResultHolderType; // construction ActiveResult(ActiveResultHolderType* pHolder); ActiveResult(const ActiveResult& result); // methods ActiveResult& operator=(const ActiveResult& result); void swap(ActiveResult& result); void wait(); bool tryWait(long milliseconds); void wait(long milliseconds); bool available() const; bool failed() const; std::string error() const; Exception* exception() const; void notify(); void error(const std::string& msg); void error(const Exception& exc); };
Detailed Documentation
This class holds the result of an asynchronous method invocation (see class ActiveMethod).
It is used to pass the result from the execution thread back to the invocation thread.
Methods
ActiveResult& operator=(const ActiveResult& result)
Assignment operator.
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.
bool available() const
Returns true if a result is 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 notify()
Notifies the invoking thread that the result became available.
For internal use only.
void error(const std::string& msg)
Sets the failed flag and the exception message.
void error(const Exception& exc)
Sets the failed flag and the exception message.