English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] recursive mutexes?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-11-12 (08:40)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] recursive mutexes?
> Does the Mutex module allow "recursive" mutexes

No.  A thread blocks forever if it attempts to lock a mutex it already
locked before.

> (the reference manual is not fully clear on this, and
> it is an important point).

I agree the documentation should be clearer on this point.

> AFAIK some Posix threads accept recursive locking.

Some do, but the POSIX 1003.1c standard specifies non-recursive
mutexes only.  There are endless arguments on the usefulness/evilness
of recursive mutexes on comp.programming.threads; the jury is still
out on this one.  

Of course, it is not difficult to implement recursive mutexes yourself
on top of normal mutexes.  You won't be able to use your recursive
mutexes in conjunction with condition variables, though.

- Xavier Leroy
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners