Programs that use the threads library must be linked as follows:
ocamlc -thread other options threads.cma other files
The -thread option selects a special, thread-safe version of
the standard library (see chapter 8). The -thread
option must also be given when compiling any source file that
references modules from the thread library (Thread, Mutex, ...).
The default thread implementation cannot be used in native-code
programs compiled with ocamlopt. If your operating system provides
POSIX 1003.1c compliant threads, you can select an alternate
implementation when configuring Objective Caml (use the
-with-pthread option to configure) which also supports native-code
programs. Programs that use this alternate implementation of the
threads library must be linked as follows:
ocamlc -thread other options threads.cma other files
ocamlopt -thread other options threads.cmxa other files
Depending on the operating system, extra system libraries can be
necessary. For instance, under Solaris 2.5, add -cclib -lposix4
at the end of the command line.