Module fiber

Source
Expand description

Сooperative multitasking module

With the fiber module, you can:

  • create, run and manage fibers,
  • use a synchronization mechanism for fibers, similar to “condition variables” and similar to operating-system functions such as pthread_cond_wait() plus pthread_cond_signal().

See also:

Structs§

Cond
Conditional variable for cooperative multitasking (fibers).
Fiber
A fiber is a set of instructions which are executed with cooperative multitasking.
FiberAttr
Fiber attributes container
Latch
A lock for cooperative multitasking environment
LatchGuard
An RAII implementation of a “scoped lock” of a latch. When this structure is dropped (falls out of scope), the lock will be unlocked.

Functions§

clock
Report loop begin time as double (cheap). Uses monotonic clock.
clock64
Report loop begin time as 64-bit int. Uses monotonic clock.
fiber_yield
Yield control to the scheduler.
is_cancelled
Check current fiber for cancellation (it must be checked manually).
reschedule
Reschedule fiber to end of event loop cycle.
set_cancellable
Make it possible or not possible to wakeup the current fiber immediately when it’s cancelled.
sleep
Put the current fiber to sleep for at least time seconds.
time
Report loop begin time as double (cheap).
time64
Report loop begin time as 64-bit int.