//OPT: -lpthread #include #include #include #include #include #include using namespace std; void print100(int threadnum) { for(int i=0;i<100;i++) cout << "thread " << threadnum << ", line " << i << endl; } void print100plus(int threadnum, int &x) { for(int i=0;i<100;i++) cout << "thread " << threadnum << " (" << this_thread::get_id() << ") " << ", line " << i << endl; x++; } // very bad way to compute this! int computesum(int start, int end) { int ans = 0; for(int i=start;i