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.
back
3 comments
In Python, that is what gevent does.
Here's an example: http://bitbucket.org/denis/gevent/src/tip/examples/concurren...
You should check out Kilim too, tries to do similar things for Java. http://www.malhar.net/sriram/kilim/index.html
would you mind elaborating on this with an example? this sounds truly amazing, but I don't see quite how it's possible.
If 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.