Function tarantool_rust_module::coio_call [] [src]

pub unsafe extern "C" fn coio_call(
    func: Option<unsafe extern "C" fn(_: *mut BuiltinVaListTag) -> c_int>,
     ...
) -> isize

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.

@retval -1 and errno = ENOMEM if failed to create a task @retval the function return (errno is preserved).

@code static ssize_t openfile_cb(va_list ap) { const char *filename = va_arg(ap); int flags = va_arg(ap); return open(filename, flags); }

if (coio_call(openfile_cb, 0.10, "/tmp/file", 0) == -1) // handle errors. ... @endcode