MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / cycle_abs

Function cycle_abs

example/timer.cpp:12–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12task<> 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
21int main() {
22 io_context ctx;

Callers 1

mainFunction · 0.70

Calls 1

timeout_atFunction · 0.85

Tested by

no test coverage detected