Freezerburn / JBacon

A Functional Reactive Programming library inspired by Bacon.js
MIT License
4 stars 0 forks source link

fromArray stop program execution #2

Closed Freezerburn closed 11 years ago

Freezerburn commented 11 years ago

If, for any reason whatsoever, an event does not get delivered to an end recipient where the getValue method is called, using JBacon.fromArray will completely stop execution of the program. This might be caused by using JBacon.fromArray(...).filter(false), for example.

This is a side-effect of how the code works for ensuring correct ordering of the values to be passed to the first subscriber. It uses a SynchronousQueue with the methods that block until a thread is offering a value and another thread is taking a value. The getValue method for these specific events is overridden to take values from the queue, and if it never gets used due to events not being delivered, then the main thread will be permanently stuck waiting for something to take from the queue.

This could also be an issue where if an event is passed to multiple subscribers/child streams, the getValue method will block permanently because the value is only ever offered once.

Freezerburn commented 11 years ago

This has been resolved