Question: please modify the code so that the program runs with out bugs. no mutex or semphore or atomic. the program cannot have any synchronization #include

please modify the code so that the program runs with out bugs. no mutex or semphore or atomic. the program cannot have any synchronization
#include
#include
#include
#include
#include
using namespace std;
typedef int item;
int bufferSize;
int reps;
vectorbuffer;
int in=0;
int counter =0;
int out=0;
void producer (){
while (counter> bufferSize;
cout << "Enter counter limit: ";
cin >> reps;
buffer[bufferSize];
thread prod (producer);
thread cons (consumer);
prod.join();
cons.join();
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!