Anonymous user
Mutex: Difference between revisions
→{{header|OCaml}}
m (→POSIX: if forgot) |
|||
Line 112:
{{works with|Win32}}
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;
|