The difference between goroutines and boost.fiber

I just started looking at how collaboration works. I just wondered if it is possible to implement something equal in C ++ and find boost.fiber. What is the difference between larynx and forced fibers? Could you implement something goroutine like with these fibers in C ++?

+4
source share
1 answer

So, from what I could compile from the source code of the boost.fiber library, it seems that it is really MORE more versatile and powerful than goroutines. The goroutines mantra should not share data between coroutines, but rather transfer data to them as needed. This, apparently, is possible both inside the fibers and with the channels ( boost::fibers::unbounded_channel<T>and boost::fibers::bounded_channel<T>), although I would like to keep in mind that the data is safely distributed between all the fibers in one stream. This is controlled (e.g. using mutexes) to provide only one fiber at a time, so you may not need channels for a particular use case.

, , . , , , . , Fiber (, ), . https://github.com/olk/boost-fiber/blob/master/examples/priority.cpp. , ,

, , , , , - , Fibers goroutine- , . , ( , ), ( , , ). , , -, - , .

, , , , Fibers, , , .

+9

All Articles