This is the third and last part of this sequence. We will swap the mutex (implemented as a Semaphore) with a modifier per method in the Ring Buffer class.
First let’s take a look at the output from the Eclipse IDE console:
main <<< start sequential …
main <<< done sequential
main <<< producer started …
Producer <<< started
main <<< consumer started …
main <<< waiting for threads to be done …
Consumer <<< started
Producer <<< done
Consumer <<< done
main <<< threads are done Continue reading “Producer and Consumer – Part III”