Module tarantool::fiber

source ·
Expand description

Сooperative multitasking module with optional async runtime.

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(),
  • spawn a fiber based async runtime.

See also:

Re-exports

Modules

  • Async runtime based on Tarantool fibers. Also includes sycnhronization primitives and useful traits for working with futures.

Structs

  • Fiber factory which can be used to configure the properties of the new fiber.
  • Conditional variable for cooperative multitasking (fibers).
  • OBSOLETE: This struct is being deprecated in favour of Fyber, due to them being more efficient and idiomatic.
  • Fiber attributes container
  • A helper struct which is used to store information about a fiber being created. It’s only utility is the generic parameter which are associated with it.
  • An owned permission to join on an immediate fiber (block on its termination).
  • A lock for cooperative multitasking environment
  • An RAII implementation of a “scoped lock” of a latch. When this structure is dropped (falls out of scope), the lock will be unlocked.
  • This is a typestate helper type representing the state of a Builder that hasn’t been assigned a fiber function yet.

Enums

Functions

  • Calls a function and checks whether it yielded.
  • Get Instant corresponding to event loop iteration begin time. Uses monotonic clock.
  • Returns the number of context switches of the calling fiber.
  • Creates a new fiber and schedules it for execution, returning a JoinHandle for it.
  • Async version of defer.
  • defer_procDeprecated
    Creates a new fiber and schedules it for execution, returning a JoinHandle<()> for it.
  • Yield control to the scheduler.
  • Check current fiber for cancellation (it must be checked manually).
  • Reschedule fiber to end of event loop cycle.
  • Make it possible or not possible to wakeup the current fiber immediately when it’s cancelled.
  • Put the current fiber to sleep for at least time seconds.
  • Creates a new fiber and yields execution to it immediately, returning a JoinHandle for the new fiber.
  • Async version of start.
  • start_procDeprecated
    Creates a new fiber and yields execution to it immediately, returning a [JoinHandle<()>] for the new fiber.
  • Returns control to the scheduler. Works likewise fiber::sleep(Duration::ZERO) but return error if fiber was canceled by another routine.

Type Aliases