#include #include using namespace std; int a = 0, b = 0; void suma() { while (true) { ++a; ++b; } } void resta() { while (true) { --a; --b; } } void muestra() { while (true) { cout << "a = " << a << "\t b = " << b << endl; this_thread::sleep_for(250ms); } } int main() { jthread t[3] = {jthread(suma), jthread(resta), jthread(muestra)}; }