|
Boost : |
Subject: [boost] Is there interest in an "iofiber" library?
From: VinÃcius dos Santos Oliveira (vini.ipsmaker_at_[hidden])
Date: 2019-01-02 11:46:45
I have written a completion token for Boost.Asio that is a little more
advanced than plain ASIO's spawn featuring abstractions such as join(),
detach() and even interrupt().
I'd like to know if there is interest in seeing this library merged as part
of Boost.
https://vinipsmaker.github.io/iofiber/
(there is also a mutex and a semaphore, but these are undocumented as of
now and were poorly ported from the previous token supporting abstractions
and need rework)
Boost.Fiber integration with ASIO is problematic:
https://github.com/boostorg/fiber/issues/102#issuecomment-263558882
Default Boost.Asio yield token will do as long as you don't need
communication between fibers. When primitive communication is necessary,
you can work around it by exploiting the completion token protocol. In
fact, after having rolled my own solution, I eventually was made aware of
Peter's solution (which he rolled on his own independently) which was
incredibly similar to my solution:
https://github.com/equalitie/ouinet/blob/a2afaf9932c8a23434d1f0a10be06fc40779ff5a/src/util/condition_variable.h#L72
If you need anything more advanced such as careful strand integration,
join, or interruption API, you'll just have to roll your own token. That's
what I end up doing after working around ASIO's token for many months.
There was also a recent request by Vinnie to turn Boost.Coroutine 1
deprecation warning off. This separate library would be an alternative
(although it is still a far from review-ready).
-- VinÃcius dos Santos Oliveira https://vinipsmaker.github.io/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk