From: Àî»Û°Ô (magazine.lihuiba_at_[hidden])
Date: 2006-07-05 08:32:42
I have used the recent boost::asio library in my small project, I found it very difficult to correctly write the asynchronous code. So I tried another approach ---- a Half-Sync/Half-Async, I found it much better.
The basic idea is very simple, utilize the coroutines(also called light weight threads, or user level threads) to handle multiple connections simultaneously and collaboratively. This approach has the advantange of simplicity in the Synchronous IO model, as well as the high performance in the Asynchronous IO model.
Unfortunately, there isn't any coroutine support in boost::thread, and I had to make my experiment with the fiber support in ms windows. So I suggest coroutine be support. The benefit isn't only confined to boost::asio, in fact, it's an important way to describe algorithm flow, and many dynamic languages, both old and new, are supporting this feature.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk