pub fn coio_call<F, T>(callback: &mut F, arg: T) -> isize where
    F: FnMut(Box<T>) -> i32
Expand description

Create new eio task with specified function and arguments. Yield and wait until the task is complete or a timeout occurs.

This function doesn’t throw exceptions to avoid double error checking: in most cases it’s also necessary to check the return value of the called function and perform necessary actions. If func sets errno, the errno is preserved across the call.

Returns:

  • -1 and errno = ENOMEM if failed to create a task
  • the function return (errno is preserved).
use tarantool::coio::coio_call;

let mut f = |a: Box<i32>| *a + 1;
if coio_call(&mut f, 1) == -1 {
    // handle errors.
}