Creating Message Queue with the help of threads
I am learning about creating threads and how they interact with each other, so I thought to create a simple message queue.
The model I am following is this:
https://i.stack.imgur.com/8l533.png▾
Now I am kinda stuck on an issue I am facing. Both threads wants to print something, but they overlap with each other. My thought was maybe adding a sleep to the client thread would make it work, and it was a success.
My question now would be, is my approach a...