Implementation of a producer/consumer with a blocking queue