ThreadUnix(3) OCaml library ThreadUnix(3)

# [NAME](#NAME)

ThreadUnix - Thread-compatible system calls.

# [Module](#Module)

Module ThreadUnix

# [Documentation](#Documentation)

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](#Process_handling)

*val execv* : **string -&gt; string array -&gt; unit**

*val execve* : **string -&gt; string array -&gt; string array -&gt; unit**

*val execvp* : **string -&gt; string array -&gt; unit**

*val wait* : **unit -&gt; int * Unix.process\_status**

*val waitpid* : **Unix.wait\_flag list -&gt; int -&gt; int * Unix.process\_status**

*val system* : **string -&gt; Unix.process\_status**

## [Basic input/output](#Basic_input/output)

*val read* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; int**

*val write* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; int**

*val write\_substring* : **Unix.file\_descr -&gt; string -&gt; int -&gt; int -&gt; int**

## [Input/output with timeout](#Input/output_with_timeout)

*val timed\_read* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; float -&gt; int**

See **ThreadUnix.timed\_write** .

*val timed\_write* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; float -&gt; 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.

*val timed\_write\_substring* : **Unix.file\_descr -&gt; string -&gt; int -&gt; int -&gt; float -&gt; int**

See **ThreadUnix.timed\_write** .

## [Polling](#Polling)

*val select* : **Unix.file\_descr list -&gt;** **Unix.file\_descr list -&gt;** **Unix.file\_descr list -&gt;** **float -&gt; Unix.file\_descr list * Unix.file\_descr list * Unix.file\_descr list**

## [Pipes and redirections](#Pipes_and_redirections)

*val pipe* : **?cloexec:bool -&gt; unit -&gt; Unix.file\_descr * Unix.file\_descr**

*val open\_process\_in* : **string -&gt; in\_channel**

*val open\_process\_out* : **string -&gt; out\_channel**

*val open\_process* : **string -&gt; in\_channel * out\_channel**

## [Time](#Time)

*val sleep* : **int -&gt; unit**

## [Sockets](#Sockets)

*val socket* : **?cloexec:bool -&gt;** **Unix.socket\_domain -&gt; Unix.socket\_type -&gt; int -&gt; Unix.file\_descr**

*val accept* : **?cloexec:bool -&gt; Unix.file\_descr -&gt; Unix.file\_descr * Unix.sockaddr**

*val connect* : **Unix.file\_descr -&gt; Unix.sockaddr -&gt; unit**

*val recv* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; int**

*val recvfrom* : **Unix.file\_descr -&gt;** **bytes -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; int * Unix.sockaddr**

*val send* : **Unix.file\_descr -&gt; bytes -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; int**

*val send\_substring* : **Unix.file\_descr -&gt; string -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; int**

*val sendto* : **Unix.file\_descr -&gt;** **bytes -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; Unix.sockaddr -&gt; int**

*val sendto\_substring* : **Unix.file\_descr -&gt;** **string -&gt; int -&gt; int -&gt; Unix.msg\_flag list -&gt; Unix.sockaddr -&gt; int**

*val open\_connection* : **Unix.sockaddr -&gt; in\_channel * out\_channel**

2026-10-27 OCamldoc

---

Document: ThreadUnix(3o) from ocaml-4 4.14.4-r4 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
