Seastar
High performance C++ framework for concurrent servers
|
Switch the current task scheduling group.
switch_to(new_scheduling_group)
can be used to change the scheduling_group of the currently running coroutine.
If the new scheduling group is different than the current scheduling_group, the coroutine is re-scheduled using the new scheduling group. Otherwise, the coroutine just continues to run with the current scheduling group.
switch_to
returns the current scheduling group to make it easy to switch back to it if needed.
Example
#include <seastar/coroutine/switch_to.hh>
Public Member Functions | |
switch_to (scheduling_group new_sg) noexcept | |
switch_to (const switch_to &)=delete | |
switch_to (switch_to &&)=delete | |
bool | await_ready () const noexcept |
template<typename T > | |
void | await_suspend (std::coroutine_handle< T > hndl) noexcept |
scheduling_group | await_resume () |
virtual void | run_and_dispose () noexcept override |
virtual task * | waiting_task () noexcept override |
Returns the next task which is waiting for this task to complete execution, or nullptr. More... | |
scheduling_group | group () const |
shared_backtrace | get_backtrace () const |
void | make_backtrace () noexcept |
Public Attributes | |
scheduling_group | _prev_sg |
scheduling_group | _switch_to_sg |
task * | _task = nullptr |
Protected Member Functions | |
scheduling_group | set_scheduling_group (scheduling_group new_sg) noexcept |
Protected Attributes | |
scheduling_group | _sg |
|
inlineoverridevirtualnoexcept |
Implements seastar::task.
|
inlineoverridevirtualnoexcept |
Returns the next task which is waiting for this task to complete execution, or nullptr.
Implements seastar::task.