|
rippled
|
Mix-in to support tests using asio coroutines. More...
#include <yield_to.h>


Public Types | |
| using | yield_context = boost::asio::yield_context |
| The type of yield context passed to functions. | |
Public Member Functions | |
| enable_yield_to (std::size_t concurrency=1) | |
| ~enable_yield_to () | |
| boost::asio::io_context & | get_io_context () |
Return the io_context associated with the object. | |
| template<class F0 , class... FN> | |
| void | yield_to (F0 &&f0, FN &&... fn) |
| Run one or more functions, each in a coroutine. | |
Protected Attributes | |
| boost::asio::io_context | ios_ |
Private Member Functions | |
| void | spawn () |
| template<class F0 , class... FN> | |
| void | spawn (F0 &&f, FN &&... fn) |
Private Attributes | |
| boost::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > | work_ |
| std::vector< std::thread > | threads_ |
| std::mutex | m_ |
| std::condition_variable | cv_ |
| std::size_t | running_ = 0 |
Mix-in to support tests using asio coroutines.
Derive from this class and use yield_to to launch test functions inside coroutines. This is handy for testing asynchronous asio code.
Definition at line 28 of file yield_to.h.
| using beast::test::enable_yield_to::yield_context = boost::asio::yield_context |
The type of yield context passed to functions.
Definition at line 44 of file yield_to.h.
|
explicit |
Definition at line 46 of file yield_to.h.
| beast::test::enable_yield_to::~enable_yield_to | ( | ) |
Definition at line 54 of file yield_to.h.
| boost::asio::io_context & beast::test::enable_yield_to::get_io_context | ( | ) |
Return the io_context associated with the object.
Definition at line 63 of file yield_to.h.
| void beast::test::enable_yield_to::yield_to | ( | F0 && | f0, |
| FN &&... | fn | ||
| ) |
Run one or more functions, each in a coroutine.
This call will block until all coroutines terminate.
Each functions should have this signature:
| fn... | One or more functions to invoke. |
Definition at line 102 of file yield_to.h.
|
private |
Definition at line 91 of file yield_to.h.
|
private |
Definition at line 112 of file yield_to.h.
|
protected |
Definition at line 31 of file yield_to.h.
|
private |
Definition at line 36 of file yield_to.h.
|
private |
Definition at line 37 of file yield_to.h.
|
private |
Definition at line 38 of file yield_to.h.
|
private |
Definition at line 39 of file yield_to.h.
|
private |
Definition at line 40 of file yield_to.h.