| 10 | } |
| 11 | |
| 12 | task<> cycle_abs(int sec, const char *message) { |
| 13 | auto next = std::chrono::steady_clock::now(); |
| 14 | while (true) { |
| 15 | next = next + std::chrono::seconds{sec}; |
| 16 | co_await timeout_at(next); |
| 17 | printf("%s\n", message); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | int main() { |
| 22 | io_context ctx; |