| 81 | } |
| 82 | |
| 83 | void bind_allocator_to_function_object_test() |
| 84 | { |
| 85 | io_context ioc; |
| 86 | |
| 87 | int count = 0; |
| 88 | int allocations = 0; |
| 89 | |
| 90 | timer t(ioc, chronons::seconds(1)); |
| 91 | t.async_wait( |
| 92 | bind_allocator( |
| 93 | test_allocator<int>(&allocations), |
| 94 | bindns::bind(&increment, &count))); |
| 95 | |
| 96 | BOOST_ASIO_CHECK(count == 0); |
| 97 | BOOST_ASIO_CHECK(allocations == 1); |
| 98 | |
| 99 | ioc.run(); |
| 100 | |
| 101 | BOOST_ASIO_CHECK(count == 1); |
| 102 | BOOST_ASIO_CHECK(allocations == 0); |
| 103 | |
| 104 | t.async_wait( |
| 105 | bind_allocator( |
| 106 | test_allocator<int>(&allocations), |
| 107 | bind_allocator( |
| 108 | std::allocator<void>(), |
| 109 | bindns::bind(&increment, &count)))); |
| 110 | |
| 111 | BOOST_ASIO_CHECK(count == 1); |
| 112 | BOOST_ASIO_CHECK(allocations == 1); |
| 113 | |
| 114 | ioc.restart(); |
| 115 | ioc.run(); |
| 116 | |
| 117 | BOOST_ASIO_CHECK(count == 2); |
| 118 | BOOST_ASIO_CHECK(allocations == 0); |
| 119 | } |
| 120 | |
| 121 | struct incrementer_token_v1 |
| 122 | { |
nothing calls this directly
no test coverage detected