3 ms·
It is but most of those module are not written like that. For example Python's eventlet and gevent are based on greenlet. Greenlet is based underneath on large
by rdtsc 13y ago
It is but most of those module are not written like that.
For example Python's eventlet and gevent are based on greenlet. Greenlet is based underneath on large select/epoll/kqueue/poll loop. So there are callbacks for IO readiness there. However they manage to do some tricks to hide that away behind green threads at the user level. So a user can say: " authorize() ; check_database(); charge_credit_card(); update_database(); send_response()" logic properly for each request for example. Without having to split that logic into a chain of callbacks just because some of them might involve at some point making a socket call.