Module Fd.Close
The Close module exists to collect close and its associated types, so they can be easily reused elsewhere, e.g., Unix_syscalls.
type socket_handling=|Shutdown_socket|Do_not_shutdown_sockettype file_descriptor_handling=|Close_file_descriptor of socket_handling|Do_not_close_file_descriptor
val close : ?file_descriptor_handling:file_descriptor_handling -> t -> unit Async_unix__.Import.Deferred.tclose tprevents further use oft, and makesshutdown()andclose()system calls ont's underlying file descriptor according to thefile_descriptor_handlingargument and whether or nottis a socket, i.e.,kind t = Socket `Active:| file_descriptor_handling | shutdown() | close() | |----------------------------------------------+------------+---------| | Do_not_close_file_descriptor | no | no | | Close_file_descriptor Shutdown_socket | if socket | yes | | Close_file_descriptor Do_not_shutdown_socket | no | yes |The result of
closebecomes determined once the system calls complete. It is OK to callclosemultiple times on the samet; calls subsequent to the initial call will have no effect, but will return the same deferred as the original call.