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

Function g

example/cancel_io.cpp:20–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20task<> g(user_data_channel &ch) {
21 printf("g() is running...\n");
22
23 auto io = timeout(999s);
24 co_await ch.release(io.user_data()); // cancel by others
25
26 int result = co_await io;
27
28 if (result < 0) [[likely]] {
29 printf("g() got error: %d %s\n", result, strerror(-result));
30 } else {
31 printf("g() got result: %d\n", result);
32 }
33}
34
35task<> f() {
36 user_data_channel ch;

Callers 1

fFunction · 0.70

Calls 3

timeoutFunction · 0.85
user_dataMethod · 0.80
releaseMethod · 0.45

Tested by

no test coverage detected