Home | Libraries | People | FAQ | More |
A disposable handle for an eager operation.
template< typename Signature = void(), typename Executor = boost::asio::any_io_executor, typename Allocator = std::allocator<void>> struct promise
Name |
Description |
---|---|
The value that's returned by the promise. |
Name |
Description |
---|---|
Cancel the promise. Usually done through the destructor. |
|
Check if the promise is completed already. |
|
Wait for the promise to become ready. |
|
promise [constructor] |
|
~promise [destructor] |
Destruct the promise and cancel the operation. |
The signature of the operation.
The executor to be used by the promise (taken from the operation).
The allocator used for the promise. Can be set through use_allocator.
A promise can be used to initiate an asynchronous option that can be completed later. If the promise gets destroyed before completion, the operation gets a cancel signal and the result is ignored.
A promise fulfills the requirements of async_operation.
Reading and writing from one coroutine.
awaitable<void> read_write_some(boost::asio::ip::tcp::socket & sock, boost::asio::mutable_buffer read_buf, boost::asio::const_buffer to_write) { auto p = boost::asio::async_read(read_buf, boost::asio::use_awaitable); co_await boost::asio::async_write_some(to_write, boost::asio::deferred); co_await p; }
Header: boost/asio/experimental/promise.hpp
Convenience header: None