Function tarantool::fiber::defer

source ·
pub fn defer<'f, F, T>(f: F) -> JoinHandle<'f, T>where
    F: FnOnce() -> T + 'f,
    T: 'f,
Expand description

Creates a new fiber and schedules it for execution, returning a JoinHandle for it.

NOTE: On older versions of tarantool this will create a lua fiber which is less efficient. You can use ffi::has_fiber_set_ctx to check if your version of tarantool has api needed for this function to work efficiently.

The new fiber can be joined by calling JoinHandle::join method on it’s join handle.