reimplement Parallel.forEach() to use ProducerConsumer