Producer/Consumer in C based on exercise 6.40 from Operating System Concepts by Silberschatz, Galvin et Gagne