Library: Foundation
Package: Threading
Header: Poco/ActiveResult.h
Creates an ActiveResultHolder. Pauses the caller until the result becomes available. Waits up to the specified interval for the result to become available. Returns true if the result became available, false otherwise. Waits up to the specified interval for the result to become available. Throws a TimeoutException if the result did not became available. Notifies the invoking thread that the result became available. Returns true if the active method failed (and threw an exception). Information about the exception can be obtained by calling error(). 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. If the active method threw an exception, a clone of the exception object is returned, otherwise null. Sets the exception. Sets the exception. 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.
Member Functions: available, data, error, exception, failed, notify, operator =, swap, tryWait, wait
typedef ActiveResultHolder < ResultType > ActiveResultHolderType;
typedef RT ResultType;
ActiveResult(
ActiveResultHolderType * pHolder
);
Creates the active result. For internal use only.
ActiveResult(
const ActiveResult & result
);
Copy constructor.
~ActiveResult();
Destroys the result.
bool available() const;
Returns true if a result is available.
ResultType & data() const;
Returns a reference to the result data.
void data(
ResultType * pValue
);
ResultType & data();
Returns a non-const reference to the result data. For internal use only.
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.
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.
Exception * exception() const;
If the active method threw an exception, a clone of the exception object is returned, otherwise null.
bool failed() const;
Returns true if the active method failed (and threw an exception). Information about the exception can be obtained by calling error().
void notify();
Notifies the invoking thread that the result became available. For internal use only.
ActiveResult & operator = (
const ActiveResult & result
);
Assignment operator.
void swap(
ActiveResult & result
);
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();
Pauses the caller until the result becomes available.
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.