This is pretty ugly. Let's try the semaphore approach. http://stackoverflow.com/questions/22716657/tell-the-consumer-of-multiple-producers-that-there-are-no-more-results#22717670