Hi, I'm new to C, and an assignment for multithreading was just kind of thrown at me, so I'm kind of lost.
I need to write a program that creates four threads.
The first thread would have to read stdin, writes the char to array of 64 bytes, and after it finishes with this job, it will wake up the second thread, and block. The second array will run, read the data from that array, translate it, pass the result to another array of 64 bytes, it would wake up the first and third thread (which will read the second array), and block itself.
So that's the general idea.
My question is, how would I code the array such that it will be shared by the threads (which will be running different functions in different .c files)? Do I just declare it as global variables and mutex the threads so that they won't be accessing the arrays at the same time?
Sorry if it's kind of confusing, I'm not sure what are the proper (technical) terms to use.