caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] recursive mutexes?
@ 2002-11-08 15:20 Basile STARYNKEVITCH
  2002-11-11  9:55 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Basile STARYNKEVITCH @ 2002-11-08 15:20 UTC (permalink / raw)
  To: caml_list

Dear All,

Does the Mutex module allow "recursive" mutexes, so can I code
something like

let mylock = Mutex.create ();;

let innerf () =
   Mutex.lock mylock;
   Printf.printf "in innerf\n";
   Mutex.unlock mylock
;;

let f () = 
    Mutex.lock mylock;
    (* do something complicated, then ... *)
    innerf ();
    Mutex.unlock mylock
;;

I expect that the lock in innerf always succeed, since mylock is
already locked by the same thread in the caller function f. Am I right
in thinking so?  (the reference manual is not fully clear on this, and
it is an important point).

FWIW my plateform is Linux/x86 with pthreads but I would like a
"definitive" statement from our Inria team on this point.

AFAIK some Posix threads accept recursive locking.

regards.
-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-12  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08 15:20 [Caml-list] recursive mutexes? Basile STARYNKEVITCH
2002-11-11  9:55 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).