4 ms·
This is kind of the point of Google's Go language (and many languages before it...). Most things are asynchronous calls hidden behind synchronous ones. Get the
by signa11 17y ago
This is kind of the point of Google's Go language (and many languages before it...). Most things are asynchronous calls hidden behind synchronous ones. Get the advantages of async with the development ease of synchronous.
- etherealG 17y agowould you mind elaborating on this with an example? this sounds truly amazing, but I don't see quite how it's possible.
- barrkel 17y agoIf you have green threads, and you wrap calls that may block such that they redirect to your own scheduler, you can simply save the green thread context, initiate an async call, and when the async call completes you can restore the thread and reschedule it. Your scheduler may be as simple as a bunch of threads using work-stealing queues to grab jobs; a job is scheduled by adding it to a queue.
- denik 17y agoIn Python, that is what gevent does. Here's an example: http://bitbucket.org/denis/gevent/src/tip/examples/concurrent_download.py http://bitbucket.org/denis/gevent/src/tip/examples/concurren...
- anonymousDan 17y agoYou should check out Kilim too, tries to do similar things for Java. http://www.malhar.net/sriram/kilim/index.html http://www.malhar.net/sriram/kilim/index.html