Question: C++ Write a program in which: (1) there is a global 100-element array of numbers of type int (2) an additional thread generates n numbers
C++
Write a program in which: (1) there is a global 100-element array of numbers of type int (2) an additional thread generates n numbers and inserts them into an array, (3) the main thread of the program displays generated numbers. Additional thread code should be placed in the class. The class constructor receives by the parameter value of n (how many numbers to generate). Since the main thread must wait for the data for synchronization use: appropriate lock, a global conditional variable and a global logical flag (variable of type bool).
Thread code-class
Generating data, view data
Creating a thread, passing parameters
Declarations of appropriate items for syncronization
Using the condition variable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
