Question: using c + + and object oriented program answer the following: Write a simple multithreaded application that prints to the console. The application has one
using c and object oriented program answer the following:
Write a simple multithreaded application that prints to the console. The application has one global variable
called "run". This variable is initially set to or false.
The application also contains three ordinary functions these are not lambdas
Function star: continuously prints the star character to the console while run is true.
Function plus: continuously prints the plus character to the console while run is true.
Function main: which is the entry point, does the following...
Sets global variable run or true
Starts executing star and plus functions as threads
Prints the string "Hello world!" to the console
Sets run or false
Waits for the threads to join
In this interesting application, all three functions print to the console separately. Each time it is run, the output
should be different depending on how the OS switches between the three tasks.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
