Module ThreadUnix

module ThreadUnix: sig .. end
Deprecated.The functionality of this module has been merged back into the Unix module. Threaded programs can now call the functions from module Unix directly, and still get the correct behavior (block the calling thread, if required, but do not block all threads in the process).

Thread-compatible system calls.


Process handling

let execv: (string, array(string)) => unit;
let execve: (string, array(string), array(string)) => unit;
let execvp: (string, array(string)) => unit;
let wait: unit => (int, Unix.process_status);
let waitpid: (list(Unix.wait_flag), int) => (int, Unix.process_status);
let system: string => Unix.process_status;

Basic input/output

let read: (Unix.file_descr, bytes, int, int) => int;
let write: (Unix.file_descr, bytes, int, int) => int;
let write_substring: (Unix.file_descr, string, int, int) => int;

Input/output with timeout

let timed_read: (Unix.file_descr, bytes, int, int, float) => int;
let timed_write: (Unix.file_descr, bytes, int, int, float) => int;

Behave as ThreadUnix.read and ThreadUnix.write, except that Unix_error(ETIMEDOUT,_,_) is raised if no data is available for reading or ready for writing after d seconds. The delay d is given in the fifth argument, in seconds.

let timed_write_substring: (Unix.file_descr, string, int, int, float) => int;

Polling

let select:
  (
    list(Unix.file_descr),
    list(Unix.file_descr),
    list(Unix.file_descr),
    float
  ) =>
  (list(Unix.file_descr), list(Unix.file_descr), list(Unix.file_descr));

Pipes and redirections

let pipe: (~cloexec: bool=?, unit) => (Unix.file_descr, Unix.file_descr);
let open_process_in: string => in_channel;
let open_process_out: string => out_channel;
let open_process: string => (in_channel, out_channel);

Time

let sleep: int => unit;

Sockets

let socket:
  (~cloexec: bool=?, Unix.socket_domain, Unix.socket_type, int) =>
  Unix.file_descr;
let accept:
  (~cloexec: bool=?, Unix.file_descr) => (Unix.file_descr, Unix.sockaddr);
let connect: (Unix.file_descr, Unix.sockaddr) => unit;
let recv: (Unix.file_descr, bytes, int, int, list(Unix.msg_flag)) => int;
let recvfrom:
  (Unix.file_descr, bytes, int, int, list(Unix.msg_flag)) =>
  (int, Unix.sockaddr);
let send: (Unix.file_descr, bytes, int, int, list(Unix.msg_flag)) => int;
let send_substring:
  (Unix.file_descr, string, int, int, list(Unix.msg_flag)) => int;
let sendto:
  (Unix.file_descr, bytes, int, int, list(Unix.msg_flag), Unix.sockaddr) =>
  int;
let sendto_substring:
  (Unix.file_descr, string, int, int, list(Unix.msg_flag), Unix.sockaddr) =>
  int;
let open_connection: Unix.sockaddr => (in_channel, out_channel);