If its child iterators aren't finished, Producer can't know if there are or aren't any more items coming. It then has no choice but to [re]set the ConditionWaitHandle "bell" upon request for values. However, if there are no more items, the bell will throw an UnexpectedValueException rather than failing gracefully; one that is indistinguishable from a ConditionWaitHandle failing elsewhere up the stack and being notified to the bell by a child iterator. Therefore, true race conditions or timing errors in child iterators involving ConditionWaitHandle get smothered when wrapped in a Producer; the Producer simply quits early.
If its child iterators aren't finished,
Producer
can't know if there are or aren't any more items coming. It then has no choice but to [re]set theConditionWaitHandle
"bell" upon request for values. However, if there are no more items, the bell will throw anUnexpectedValueException
rather than failing gracefully; one that is indistinguishable from aConditionWaitHandle
failing elsewhere up the stack and being notified to the bell by a child iterator. Therefore, true race conditions or timing errors in child iterators involvingConditionWaitHandle
get smothered when wrapped in aProducer
; theProducer
simply quits early.