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
Hi there,
I am currently researching the behavior of non-blocking code such as boost::fiber under different scheduling mechanisms. One such mechanism is the symmetric transfer, wherein one fiber is suspended and another fiber is immediately resumed with no caller/callee relationship between the two.
Hence, I would like to explicitly resume a previously suspended fiber in the current thread, bypassing the scheduler. Assume I have a list of suspended fibers, represented by their contexts, for example as
std::deque<context*> suspended_contexts;
Now, in a running fiber, let's call it F, I would like to be able to yield F and then resume suspended_contexts.front() without passing control to any other fibers that may be in the scheduler's ready queue. However, I seem to be unable to get context->attach(), context->resume() or any other method used throughout the codebase to work.
I know that the scheduler realizes a context switch between fibers through
// resume another context
algo_->pick_next()->resume();
however, when I use next_fiber_context = suspended_contexts.front(), my code deadlocks on the call to resume().
Am I missing something crucial about the fiber context switch?
Could you direct me to a more detailed documentation of a context switch as it is used in the library?
Moreover, is there a way to pass the suspended fiber F to the scheduler so that another thread may execute it in the meantime? A fiber must be explicitly enqueued into the scheduler's ready queue by calling awakened(ctx). Is it safe to do so with ctx = context::active()?
The text was updated successfully, but these errors were encountered:
Hi there,
I am currently researching the behavior of non-blocking code such as boost::fiber under different scheduling mechanisms. One such mechanism is the symmetric transfer, wherein one fiber is suspended and another fiber is immediately resumed with no caller/callee relationship between the two.
Hence, I would like to explicitly resume a previously suspended fiber in the current thread, bypassing the scheduler. Assume I have a list of suspended fibers, represented by their contexts, for example as
Now, in a running fiber, let's call it
F
, I would like to be able to yieldF
and then resumesuspended_contexts.front()
without passing control to any other fibers that may be in the scheduler's ready queue. However, I seem to be unable to getcontext->attach()
,context->resume()
or any other method used throughout the codebase to work.I know that the scheduler realizes a context switch between fibers through
which essentially does
however, when I use
next_fiber_context = suspended_contexts.front()
, my code deadlocks on the call toresume()
.Am I missing something crucial about the fiber context switch?
Could you direct me to a more detailed documentation of a context switch as it is used in the library?
Moreover, is there a way to pass the suspended fiber
F
to the scheduler so that another thread may execute it in the meantime? A fiber must be explicitly enqueued into the scheduler's ready queue by callingawakened(ctx)
. Is it safe to do so withctx = context::active()
?The text was updated successfully, but these errors were encountered: