acrylic-origami / HHReactor

Producer-based Reactor for Hack
MIT License
2 stars 0 forks source link

Replace Exceptions for signaling end of iteration #3

Open acrylic-origami opened 7 years ago

acrylic-origami commented 7 years ago

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.