Module coio
READ event
WRITE event
Wait until READ or WRITE event on socket (fd). Yields.
Parameters:
-
fd(int) — non-blocking socket file description -
event(int) — requested events to wait. Combination ofCOIO_READ | COIO_WRITEbit flags. -
timeout(double) — timeout in seconds.
Returns
0 - timeout
Returns
0 - returned events. Combination of
TNT_IO_READ | TNT_IO_WRITEbit flags.
Create new eio task with specified function and arguments. Yield and wait until the task is complete. This function may use the worker_pool_threads configuration parameter.
To avoid double error checking, this function does not throw exceptions. In most cases it is 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
Returns
the function's return (errno is preserved).
Example:
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, "/tmp/file", 0) == -1)// handle errors....
Fiber-friendly version of getaddrinfo(3).
Close the fd and wake any fiber blocked in
coio_wait() call on this fd.
fd(int) — non-blocking socket file description
Returns
the result of close(fd), see close(2)