[][src]Struct tarantool_module::fiber::Fiber

pub struct Fiber<'a, T: 'a> { /* fields omitted */ }

Contains information about fiber

Implementations

impl<'a, T> Fiber<'a, T>[src]

pub fn new<F>(name: &str, callback: &mut F) -> Self where
    F: FnMut(Box<T>) -> i32
[src]

Create a new fiber.

Takes a fiber from fiber cache, if it's not empty. Can fail only if there is not enough memory for the fiber structure or fiber stack.

The created fiber automatically returns itself to the fiber cache when its main function completes.

  • name - string with fiber name
  • callback - function for run inside fiber

See also: start

pub fn new_with_attr<F>(
    name: &str,
    fiber_attr: &FiberAttr,
    callback: &mut F
) -> Self where
    F: FnMut(Box<T>) -> i32
[src]

Create a new fiber with defined attributes.

Can fail only if there is not enough memory for the fiber structure or fiber stack.

The created fiber automatically returns itself to the fiber cache if has default stack size when its main function completes.

  • name - string with fiber name
  • fiber_attr - fiber attributes
  • callback - function for run inside fiber

See also: start

pub fn start(&mut self, arg: T)[src]

Start execution of created fiber.

  • arg - argument to start the fiber with

See also: new

pub fn wakeup(&self)[src]

Interrupt a synchronous wait of a fiber

pub fn join(&self) -> i32[src]

Wait until the fiber is dead and then move its execution status to the caller. The fiber must not be detached (See also: set_joinable).

Returns fiber function ret code

pub fn set_joinable(&mut self, is_joinable: bool)[src]

Set fiber to be joinable (false by default).

  • is_joinable - status to set

pub fn cancel(&mut self)[src]

Cancel the subject fiber. (set FIBER_IS_CANCELLED flag)

If target fiber's flag FIBER_IS_CANCELLABLE set, then it would be woken up (maybe prematurely). Then current fiber yields until the target fiber is dead (or is woken up by wakeup).

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Fiber<'a, T> where
    T: RefUnwindSafe

impl<'a, T> !Send for Fiber<'a, T>

impl<'a, T> !Sync for Fiber<'a, T>

impl<'a, T> Unpin for Fiber<'a, T>

impl<'a, T> UnwindSafe for Fiber<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.