21 Sep
2016
21 Sep
'16
7:50 a.m.
The current example seems non-flexible and very hacky. 1. The timer handler has no problem, since it's expected to be called from any thread. (Description in "Deeper Dive into asio" is meaningless) 2. Possible alternatives: * A post(empty lambda) is a little bit waste but solves the threading problem. It wakes up one thread by doing interrupt of epoll etc. Maybe adding a interrupt method to asio codebase could be more efficient. * One thread doing event polling and the other doing condvar is enough. Since we're not expecting a slow handler (most times, it just make a fiber ready), this should be sufficient. Correct me if I'm wrong.