Mutex: Difference between revisions

Content added Content deleted
m (→‎POSIX: if forgot)
Line 112: Line 112:
{{works with|Win32}}
{{works with|Win32}}
See C example
See C example

=={{header|OCaml}}==

OCaml provides a build-in [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Mutex.html Mutex module]. <BR>
It is very simple, there are four functions:

let m = Mutex.create() in
Mutex.lock m; (* locks in blocking mode *)
if (Mutex.try_lock m)
then ... (* did the lock *)
else ... (* already locked, do not block *)
Mutex.unlock m;