ProducerConsumerThreads
Threaded producer and consume program used to print user input to the terminal. Makes use of mutexs, condition variables and structs.
Mainline acts as the producer thread, reading input from the user. This input is then passed to the next available and waiting consumer thread which handles the user input and sends it to a printer thread to be printed to the console.
The program makes use of mutexs, condition variables and structs to ensure shared resources are used properly and also that to ensure that a race condition doesn't come into existence.
Usage
To begin with compile printer.c
make
Run program
./printer
Example
./printer
Enter 'quit' to exit program...
Enter a string: string one
2: string one
Enter a string: hello
3: hello
Enter a string: foobar furey
1: foobar furey
Enter a string: gitya
2: gitya
Enter a string: quit
Goodbye!