developit / greenlet

🦎 Move an async function into its own thread.
https://npm.im/greenlet
4.67k stars 100 forks source link

Generator functions #35

Closed Ayc0 closed 2 years ago

Ayc0 commented 6 years ago

Is it possible to support generator functions in addition to async functions?

developit commented 6 years ago

Yes, and I really want to get this supported!

If you or anyone coming across this wants to try implementing it in Greenlet, I'd be delighted to work with you to get it merged.

DCtheTall commented 5 years ago

I'd be happy to take a swing at this.

I assume it will always return an instance of a AsyncGeneratorFunction?

developit commented 5 years ago

Whoops, sorry for the slow reply! Yes this would coerce the main thread to an async generator, regardless of whether it is synchronous or asynchronous.

johnsonjo4531 commented 4 years ago

@Ayc0 @DCtheTall @developit hey, I made an attempt at this. Feel free to review. Hope you don't mind I took a shot at it 😅. I just was thinking about how useful this could be, and I also wanted to try and use it in a project, so I was hoping it would come sooner rather than later!