Producer/consumer wait in a while loop to ensure condition is met.