Portable fibers

I'm implementing an M:N job scheduler and I'd like for jobs to be able to be suspended in the middle of a stack. I'm wondering if there are any coroutine implementations that support semantics similar to those of Windows fibers. Specifically, I want for a coroutine to be able to yield in one thread and be resumed in another. I know about Boost.coroutine, but unfortunately it doesn't support thread migration, from what I've read.

Wikipedia claims[1] that fibers can be implemented with pthread using the {make|get|set|swap}context() functions. Does anyone know if these functions allow contexts to be moved around threads? A quick scan through the man pages[2][3] doesn't seem to imply that this would be a problem.


[1] https://en.wikipedia.org/wiki/Fiber_%28computer_science%29#Operating_system_support
[2] http://man7.org/linux/man-pages/man3/getcontext.3.html
[3] http://man7.org/linux/man-pages/man3/swapcontext.3.html
boost.fiber https://github.com/boostorg/fiber

Not part of Boost (yet); has to be manually placed (or symlinked) into the libs/fiber directory under Boost
Not part of Boost (yet)

boost.fiber was just accepted earlier this month http://lists.boost.org/boost-announce/2016/06/0474.php so, hoping for 1.62!
Great, thanks!
Topic archived. No new replies allowed.