| 30 | } |
| 31 | |
| 32 | int main() { |
| 33 | io_context ctx[6]; |
| 34 | ctx[0].co_spawn(produce("p0")); |
| 35 | ctx[1].co_spawn(produce("p1")); |
| 36 | ctx[2].co_spawn(produce("p2")); |
| 37 | |
| 38 | ctx[3].co_spawn(consume("c0")); |
| 39 | ctx[4].co_spawn(consume("c1")); |
| 40 | ctx[5].co_spawn(consume("c2")); |
| 41 | |
| 42 | for (auto &c : ctx) { |
| 43 | c.start(); |
| 44 | } |
| 45 | |
| 46 | ctx[0].join(); |
| 47 | return 0; |
| 48 | } |