//--------------------------------------------------------- // com_jthread.cc //--------------------------------------------------------- #include #include #include int main() { const std::size_t N = 'z' - 'a' + 2; // letters + null terminator char msg[N] = {'\0'}; std::jthread escritor([&] { std::iota(msg, msg + N - 1, 'a'); std::cout << "writer: " << msg << '\n'; std::jthread lector([&] { std::cout << "reader: " << msg << '\n'; }); }); }