#include #include #include #include using namespace std ; int shared_data = 0; // Shared resource void increment_shared_data() { for (int i1 = 1; i1 <= 100; ++i1 ) { //TO DO Fix the issue Hint: use mutex int temp = shared_data ; //cout << "Value of i1:" << i1 << endl ; shared_data = temp + 1 ; } } int main() { vector threads; // Create multiple threads that will concurrently modify shared_data for (int i1 = 0; i1 < 5; ++i1) { threads.push_back( thread(increment_shared_data) ); } // Join all threads to wait for their completion for (thread& t1 : threads) { t1.join(); } cout << "Final value of shared_data: " << shared_data << endl; return 0; }