laverdet/node-fibers — Issue #46: Question about run/yield
Author: scriby
Created: 2012-01-15 01:19:15+00:00
State: open

Hi,

I'm trying to implement an asynchronous generator with one fiber. I think it might not be possible, though.

1. I set up a fiber which is not running, and return a bound version of the run function
2. I call fiber.run from function A
3. The fiber calls async function B, then yields
4. After B finishes, it calls fiber.run, passing control back to the fiber
5. Now, the fiber yields, but control is passed back to B
6. The program halts, and control never gets passed back to A

Is there any way to get control back to A in the above scenario?

Thanks,

Chris