[asio] condition_variable for coroutine-powered ASIO
Hi, Since Boost 1.54, ASIO introduced yield_context, which is very helpful to alleviate the pain of writing async ops. Unlike multi-threading, with cooperative multi-tasking, generally we don't have to worry about synchronization, but we still need some sort of mechanism to sync the coroutines in cases like producer-consumer for waiting the data... While I haven't seen any sync tool for asio/coroutine, having a condition_variable or such may be very useful, what do you think? Attached is the poor-man's implementation...
Using condition-vars withcorpoutones is uncommon. If you need sync. between executoon context use boost.fiber (contains mutex, cond-vats, barrier,...) based on boost.context. it contains a integration into boost.asio (eq. to yield_context) too. github.com/olk/boost-fiber
participants (2)
-
Oliver Kowalke
-
TONGARI J