[][src]Function tarantool_module::coio::coio_call

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

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).
struct FuncArgs {}

fn func(args: FuncArgs) -> i32 {}

if coio_call(func, FuncArgs{}) == -1 {
	// handle errors.
}