#include <iasync_result.h>
Represents the status of an asynchronous operation.
- Namespace
- xtd
- Library
- xtd.core
- Note
- The async_result class is the implementation of xtd::iasync_result that is returned by the begin_invoke method when you use a delegate to call a method asynchronously.
|
virtual std::any | async_state () const noexcept=0 |
| Gets a user-defined object that qualifies or contains information about an asynchronous operation. More...
|
|
virtual std::shared_mutex & | async_mutex ()=0 |
| Gets a std::mutex that is used to wait for an asynchronous operation to complete. More...
|
|
virtual bool | completed_synchronously () const noexcept=0 |
| Gets a value that indicates whether the asynchronous operation completed synchronously. More...
|
|
virtual bool | is_completed () const noexcept=0 |
| Gets a value that indicates whether the asynchronous operation has completed. More...
|
|
◆ async_mutex()
virtual std::shared_mutex& xtd::iasync_result::async_mutex |
( |
| ) |
|
|
pure virtual |
Gets a std::mutex that is used to wait for an asynchronous operation to complete.
- Returns
- A std::mutex that is used to wait for an asynchronous operation to complete.
- Notes to Implementers
- The object that implements xtd::iasync_result does not need to create the std::mutex until the xtd::iasync_result::async_mutex property is read. It is the choice of the xtd::iasync_result implementer. However, if the implementer creates xtd::iasync_result::async_mutex, it is the responsibility of the implementer to signal the std::mutex that will terminate the wait at the appropriate time. Once created, xtd::iasync_result xtd::iasync_result::async_mutex should be kept alive until the user calls the method that concludes the asynchronous operation. At that time the object behind xtd::iasync_result::async_mutex can be discarded.
- Notes to Callers
- Clients that wait for the operation to complete (as opposed to polling) use this property to obtain a synchronization object to wait on.
- Notes to Implementers
◆ async_state()
virtual std::any xtd::iasync_result::async_state |
( |
| ) |
const |
|
pure virtualnoexcept |
Gets a user-defined object that qualifies or contains information about an asynchronous operation.
- Returns
- A user-defined object that qualifies or contains information about an asynchronous operation.
- Notes to Implementers
- Implement this property to allow the caller of an asynchronous operation to obtain an application-defined object specified at the start of the operation.
- Notes to Callers
- This object can be used to pass state information for the asynchronous operation to an AsyncCallback that you provide.
◆ completed_synchronously()
virtual bool xtd::iasync_result::completed_synchronously |
( |
| ) |
const |
|
pure virtualnoexcept |
Gets a value that indicates whether the asynchronous operation completed synchronously.
- Returns
- true if the asynchronous operation completed synchronously; otherwise, false.
- Notes to Callers
- Use this property to determine if the asynchronous operation completed synchronously. For example, this property can return true for an asynchronous I/O operation if the I/O request was small.
◆ is_completed()
virtual bool xtd::iasync_result::is_completed |
( |
| ) |
const |
|
pure virtualnoexcept |
Gets a value that indicates whether the asynchronous operation has completed.
- Returns
- true if the operation is complete; otherwise, false.
- Notes to Implementers
- Implementers will typically return the value of a private field or internal test as the value of this property.
- Notes to Callers
- Clients that poll for operation status (as opposed to waiting on a synchronization object) use this property to determine the status of the operation.
The documentation for this class was generated from the following file: