|
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. More... | |
Public Member Functions | |
| enable_yield_to (std::size_t concurrency=1) | |
| ~enable_yield_to () | |
| boost::asio::io_service & | get_io_service () |
Return the io_service associated with the object. More... | |
| template<class F0 , class... FN> | |
| void | yield_to (F0 &&f0, FN &&... fn) |
| Run one or more functions, each in a coroutine. More... | |
Protected Attributes | |
| boost::asio::io_service | ios_ |
Private Member Functions | |
| void | spawn () |
| template<class F0 , class... FN> | |
| void | spawn (F0 &&f, FN &&... fn) |
Private Attributes | |
| boost::optional< boost::asio::io_service::work > | 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 29 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 43 of file yield_to.h.
|
explicit |
Definition at line 45 of file yield_to.h.
| beast::test::enable_yield_to::~enable_yield_to | ( | ) |
Definition at line 52 of file yield_to.h.
| boost::asio::io_service & beast::test::enable_yield_to::get_io_service | ( | ) |
Return the io_service associated with the object.
Definition at line 61 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 100 of file yield_to.h.
|
private |
Definition at line 89 of file yield_to.h.
|
private |
Definition at line 110 of file yield_to.h.
|
protected |
Definition at line 32 of file yield_to.h.
|
private |
Definition at line 35 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.