| 27 | namespace { |
| 28 | template<typename TC> |
| 29 | void run_some() |
| 30 | { |
| 31 | static constexpr auto MAX_FUTURES = 5; |
| 32 | ceph::timer<TC> timer; |
| 33 | std::vector<std::future<void>> futures; |
| 34 | for (auto i = 0; i < MAX_FUTURES; ++i) { |
| 35 | auto t = TC::now() + 2s; |
| 36 | std::promise<void> p; |
| 37 | futures.push_back(p.get_future()); |
| 38 | timer.add_event(t, [p = std::move(p)]() mutable { |
| 39 | p.set_value(); |
| 40 | }); |
| 41 | } |
| 42 | for (auto& f : futures) |
| 43 | f.get(); |
| 44 | } |
| 45 | |
| 46 | template<typename TC> |
| 47 | void run_orderly() |