Legend:
Library
Module
Module type
Parameter
Class
Class type
Signal handles implement Unix style signal handling on a per-event loop bases.
Reception of some signals is emulated on Windows:
SIGINT is normally delivered when the user presses CTRL+C. However, like on Unix, it is not generated when terminal raw mode is enabled.
SIGBREAK is delivered when the user pressed CTRL + BREAK.
SIGHUP is generated when the user closes the console window. On SIGHUP the program is given approximately 10 seconds to perform cleanup. After that Windows will unconditionally terminate it.
Watchers for other signals can be successfully created, but these signals are never received. These signals are: SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM and SIGKILL.
Calls to raise() or abort() to programmatically raise a signal are not detected by libuv; these will not trigger a signal watcher.
Handles are closed automatically, if they are not longer referenced from the OCaml heap. Nevertheless, you should nearly always close them with close, because:
if they wrap a file descriptor, you will sooner or later run out of file descriptors. The OCaml garbage collector doesn't give any guarantee, when orphaned memory blocks are removed.
you might have registered some repeatedly called action (e.g. timeout, read_start,...), that prevent that all references get removed from the OCaml heap.
However, it's safe to write code in this manner:
let s = Uwt.Tcp.init () in
let c = Uwt.Tcp.init () in
Uwt.Tcp.nodelay s false;
Uwt.Tcp.simultaneous_accepts true;
if foobar () then (* no file descriptor yet assigned, no need to worry
about exceptions inside foobar,... *)
Lwt.return_unit (* no need to close *)
else
...
If you want - for whatever reason - keep a file descriptor open for the whole lifetime of your process, remember to keep a reference to its handle.
Prefer close or close_noerr to close_wait. close or close_noerr return immediately (there are no useful error messages, beside perhaps a notice, that you've already closed that handle).
close_wait is only useful, if you intend to wait until all concurrent write and read threads related to this handle are canceled.
Returns non-zero if the handle is active, zero if it's inactive. What "active" means depends on the type of handle:
A Async.t handle is always active and cannot be deactivated, except by closing it with uv_close().
A Pipe.t, Tcp.t, Udp.t, etc. handle - basically any handle that deals with i/o - is active when it is doing something that involves i/o, like reading, writing, connecting, accepting new connections, etc.
Rule of thumb: if a handle of type Uwt.Foo.t has a uv_foo_start() function, then it's active from the moment that function is called. Likewise, uv_foo_stop() deactivates the handle again.