Lely core libraries 2.3.4
|
Convenience class providing a RAII-style mechanism to ensure the calling thread can be used by fiber executors for the duration of a scoped block. More...
#include <fiber_exec.hpp>
Public Member Functions | |
FiberThread (FiberFlag flags=static_cast< FiberFlag >(0), ::std::size_t stack_size=0, ::std::size_t max_unused=0) | |
Initializes the calling thread for use by fiber executors, if it was not already initialized. More... | |
FiberThread (FiberFlag flags, ::std::size_t stack_size, ::std::size_t max_unused, bool &already) | |
Initializes the calling thread for use by fiber executors, if it was not already initialized. More... | |
~FiberThread () | |
Finalizes the calling thread and prevents further use by fiber executors, unless another instance of this class is still in scope. | |
Convenience class providing a RAII-style mechanism to ensure the calling thread can be used by fiber executors for the duration of a scoped block.
Definition at line 44 of file fiber_exec.hpp.
|
inline |
Initializes the calling thread for use by fiber executors, if it was not already initialized.
flags | the flags used to initialize the internal fiber of the calling thread (see #lely::util::FiberThread) and any subsequent fibers created by a fiber executor. flags can be any supported combination of FiberFlag::SAVE_MASK, FiberFlag::SAVE_FENV, FiberFlag::SAVE_ERROR and FiberFlag::GUARD_STACK. |
stack_size | the size (in bytes) of the stack frame to be allocated for the fibers. If 0, the default size (LELY_FIBER_STKSZ) is used. The size of the allocated stack is always at least LELY_FIBER_MINSTKSZ bytes. |
max_unused | the maximum number of unused fibers kept alive for future tasks. If 0, the default number (LELY_EV_FIBER_MAX_UNUSED) is used. |
Definition at line 64 of file fiber_exec.hpp.
|
inline |
Initializes the calling thread for use by fiber executors, if it was not already initialized.
flags | the flags used to initialize the internal fiber of the calling thread (see #lely::util::FiberThread) and any subsequent fibers created by a fiber executor. flags can be any supported combination of FiberFlag::SAVE_MASK, FiberFlag::SAVE_FENV, FiberFlag::SAVE_ERROR and FiberFlag::GUARD_STACK. |
stack_size | the size (in bytes) of the stack frame to be allocated for the fibers. If 0, the default size (LELY_FIBER_STKSZ) is used. The size of the allocated stack is always at least LELY_FIBER_MINSTKSZ bytes. |
max_unused | the maximum number of unused coroutines kept alive for future tasks. If 0, the default number (LELY_EV_FIBER_MAX_UNUSED) is used. |
already | set to true if the calling thread was already initialized, and to false if not. In the former case, the values of flags, stack_size and unused are ignored. |
Definition at line 93 of file fiber_exec.hpp.