| 25 | |
| 26 | template <class Func> |
| 27 | void delayedTask(Executor* ex, Func&& func, std::size_t ms) { |
| 28 | std::thread( |
| 29 | [f = std::move(func), ms](Executor* ex) { |
| 30 | std::this_thread::sleep_for(std::chrono::milliseconds(ms)); |
| 31 | ex->schedule(std::move(f)); |
| 32 | }, |
| 33 | ex) |
| 34 | .detach(); |
| 35 | } |
| 36 | |
| 37 | void Uthread_switch(benchmark::State& state) { |
| 38 | async_simple::executors::SimpleExecutor executor(10); |