Lely core libraries  2.2.5
lely::ev::FiberThread Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FiberThread() [1/2]

lely::ev::FiberThread::FiberThread ( FiberFlag  flags = static_cast<FiberFlag>(0),
::std::size_t  stack_size = 0,
::std::size_t  max_unused = 0 
)
inline

Initializes the calling thread for use by fiber executors, if it was not already initialized.

Parameters
flagsthe 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_sizethe 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_unusedthe 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.

◆ FiberThread() [2/2]

lely::ev::FiberThread::FiberThread ( FiberFlag  flags,
::std::size_t  stack_size,
::std::size_t  max_unused,
bool &  already 
)
inline

Initializes the calling thread for use by fiber executors, if it was not already initialized.

Parameters
flagsthe 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_sizethe 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_unusedthe maximum number of unused coroutines kept alive for future tasks. If 0, the default number (LELY_EV_FIBER_MAX_UNUSED) is used.
alreadyset 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.


The documentation for this class was generated from the following file: