use conditional variable to solve the producer/consumer problem