You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use this boost-fiber in my game engine, and get these questions:
Is it highly real-time?
A problem... I uses fiber.join() as fiber.resume in ruby(enter the fiber and continue), uses boost::this_fiber::yield() as Fiber.yield in ruby(return to father fiber), and get wrong result, then I write a piece of code:
intmain(){
boost::fibers::fiber f([&] {
while (true) {
puts("ppp");
boost::this_fiber::yield();
}
});
while (true) {
f.join()
puts("qqq");
}
return0;
}
As what I thinked, it should print as:
ppp
qqq
ppp
qqq
.......
But in fact it print:
ppp
ppp
ppp
ppp
....
It seems like boost::this_fiber::yield() does not return where the fiber was called.
What should I do? Thanks a lot, I am tired of 6 hours working on config boost and using fibers..
The text was updated successfully, but these errors were encountered:
sxysxy
changed the title
Some Questions.
Some Questions.(and About Using fiber.join)
Jun 4, 2017
1.) no
2. ) API of boost.fiber is equivalent to std::thread
you can only join a fiber once (your example is wrong)
this_fiber::yield() does yield to another fiber, which fiber will be resumed next depends on the scheduling algorithm (round-robin etc.; it is a customization point) - it does not necessarily resume the father fiber. For instance if you use a scheduler that respects fiber priority, the next fiber that gets resumed is the one with the highest priority in the ready-queue.
I suggest to study the documentation of boost.fiber (contains examples) + the examples section.
I use this boost-fiber in my game engine, and get these questions:
As what I thinked, it should print as:
But in fact it print:
It seems like boost::this_fiber::yield() does not return where the fiber was called.
What should I do? Thanks a lot, I am tired of 6 hours working on config boost and using fibers..
The text was updated successfully, but these errors were encountered: