gem5
v20.1.0.0
|
These methods relate to the Coroutine interface. More...
Functions | |
template<typename T = Ret> | |
CallerType & | m5::Coroutine< Arg, Ret >::CallerType::operator() (typename std::enable_if< !std::is_same< T, void >::value, T >::type param) |
operator() is the way we can jump outside the coroutine and return a value to the caller. More... | |
template<typename T = Ret> | |
std::enable_if< std::is_same< T, void >::value, CallerType >::type & | m5::Coroutine< Arg, Ret >::CallerType::operator() () |
operator() is the way we can jump outside the coroutine More... | |
template<typename T = Arg> | |
std::enable_if<!std::is_same< T, void >::value, T >::type | m5::Coroutine< Arg, Ret >::CallerType::get () |
get() is the way we can extrapolate arguments from the coroutine caller. More... | |
m5::Coroutine< Arg, Ret >::Coroutine (std::function< void(CallerType &)> f, bool run_coroutine=true) | |
Coroutine constructor. More... | |
virtual | m5::Coroutine< Arg, Ret >::~Coroutine () |
template<typename T = Arg> | |
Coroutine & | m5::Coroutine< Arg, Ret >::operator() (typename std::enable_if< !std::is_same< T, void >::value, T >::type param) |
Coroutine interface. More... | |
template<typename T = Arg> | |
std::enable_if< std::is_same< T, void >::value, Coroutine >::type & | m5::Coroutine< Arg, Ret >::operator() () |
operator() is the way we can jump inside the coroutine. More... | |
template<typename T = Ret> | |
std::enable_if<!std::is_same< T, void >::value, T >::type | m5::Coroutine< Arg, Ret >::get () |
get() is the way we can extrapolate return values (yielded) from the coroutine. More... | |
m5::Coroutine< Arg, Ret >::operator bool () const | |
Check if coroutine is still running. More... | |
m5::Coroutine< Arg, Ret >::Coroutine ()=delete | |
m5::Coroutine< Arg, Ret >::Coroutine (const Coroutine &rhs)=delete | |
Coroutine & | m5::Coroutine< Arg, Ret >::operator= (const Coroutine &rhs)=delete |
These methods relate to the Coroutine interface.
|
delete |
|
delete |
|
inline |
Coroutine constructor.
The only way to construct a coroutine is to pass it the routine it needs to run. The first argument of the function should be a reference to the Coroutine<Arg,Ret>::caller_type which the routine will use as a way for yielding to the caller. The optional second boolean argument controls if the Coroutine should be run on creation, which mimics Boost's Coroutine semantics by default. This can be disabled as an optimization to avoid unnecessary context switches on Coroutine creation.
f | task run by the coroutine |
run_coroutine | set to false to disable running the coroutine immediately after it is created |
Definition at line 184 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::call().
|
inline |
get() is the way we can extrapolate arguments from the coroutine caller.
The coroutine blocks, waiting for the value, unless it is already available; otherwise caller execution is resumed, and coroutine won't execute until a value is pushed from the caller.
Definition at line 140 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::argsChannel, m5::Coroutine< Arg, Ret >::CallerType::callerFiber, m5::Coroutine< Arg, Ret >::CallerType::coro, and Fiber::run().
Referenced by SMMUTranslationProcess::completeTransaction(), SMMUProcess::doRead(), ItsProcess::doRead(), SMMUProcess::doWrite(), ItsProcess::doWrite(), and ItsTranslation::main().
|
inline |
get() is the way we can extrapolate return values (yielded) from the coroutine.
The caller blocks, waiting for the value, unless it is already available; otherwise coroutine execution is resumed, and caller won't execute until a value is yielded back from the coroutine.
Definition at line 249 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::call(), m5::Coroutine< Arg, Ret >::caller, and m5::Coroutine< Arg, Ret >::CallerType::retChannel.
Referenced by TEST().
|
inline |
Check if coroutine is still running.
Definition at line 266 of file coroutine.hh.
References Fiber::finished().
|
inline |
operator() is the way we can jump outside the coroutine
This method is generated only if the coroutine doesn't return a value (Ret = void)
Definition at line 120 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::CallerType::callerFiber, and Fiber::run().
|
inline |
operator() is the way we can jump inside the coroutine.
This method is generated only if the coroutine takes no arguments. (Arg = void)
Definition at line 229 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::call().
|
inline |
operator() is the way we can jump outside the coroutine and return a value to the caller.
This method is generated only if the coroutine returns a value (Ret != void)
Definition at line 101 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::CallerType::callerFiber, m5::Coroutine< Arg, Ret >::CallerType::retChannel, and Fiber::run().
|
inline |
Coroutine interface.
operator() is the way we can jump inside the coroutine and passing arguments.
This method is generated only if the coroutine takes arguments (Arg != void)
Definition at line 211 of file coroutine.hh.
References m5::Coroutine< Arg, Ret >::argsChannel, and m5::Coroutine< Arg, Ret >::call().
|
delete |
|
inlinevirtual |
Definition at line 195 of file coroutine.hh.