Library: Foundation
Package: Threading
Header: Poco/ActiveResult.h
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.
Direct Base Classes: RefCountedObject
All Base Classes: RefCountedObject
Member Functions: data, error, exception, failed, notify, tryWait, wait
Inherited Functions: duplicate, referenceCount, release
Creates an ActiveResultHolder.
ResultType & data();
Returns a reference to the actual result.
void data(
ResultType * pData
);
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 Exception & exc
);
Sets the exception.
void error(
const std::string & msg
);
Sets the exception.
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.
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.