4 ms·
Interesting. Is it like Python's Gevent in that it patches otherwise blocking calls (say socket.recv) to return to the Quasar runtime so it can switch fibers?
by smegel 12y ago
Interesting. Is it like Python's Gevent in that it patches otherwise blocking calls (say socket.recv) to return to the Quasar runtime so it can switch fibers?
- pron 12y agoIt does use bytecode injection, but it doesn't automagically intercept calls. Quasar's users use fiber-compatible implementations of existing APIs (so the code is the same, but you have to explicitly call a fiber compatible method). Those implementations aren't built from the ground up, but thin wrappers around the original library. Usually, the library's asynchronous API is used under the covers to implement its synchronous API in a way that's fiber- rather than thread-blocking.