python-broqer icon indicating copy to clipboard operation
python-broqer copied to clipboard

Yield and initial state for MapAsync and MapThreaded

Open semiversus opened this issue 6 years ago • 1 comments

MapAsync and MapThread are stateless and the first value emitted is after running the first coroutine/function. By adding an init argument the operator get's stateful with init as initial state.

Additionally explore the use of yield in the coroutine to emit values during the coroutine/function is running.

semiversus avatar Oct 02 '18 06:10 semiversus

Instead of yield it's easier to use self.notify(). For MapThreaded a threadsafe variant with loop.call_soon should be implemented.

semiversus avatar Oct 07 '18 09:10 semiversus