Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alessandro Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: [Caml-list] Question on Mutexes
Date: Tue, 18 Mar 2003 14:37:09 +0100	[thread overview]
Message-ID: <3E772105.2000307@baretta.com> (raw)

If thread t1 locks mutex m, can thread t2 unlock it?

I ask because I get no sign of exceptions being thrown when 
I execute the following code in the toplevel:

let m = Mutex.create ()
let () = Mutex.lock m
let f m' = Mutex.unlock m'
let t = Thread.create f m
let () = Mutex.lock m

Also, the final call to Mutex.lock does not block the 
execution of the program by any significant time, which 
means that mutex m is unlocked by thread t before being 
locked once again by the original thread.

Is this a bug or a feature? Are threads supposed to be able 
to unlock mutexes held by _other_ threads?

Alex

-------------------
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


             reply	other threads:[~2003-03-18 13:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18 13:37 Alessandro Baretta [this message]
2003-03-18 18:43 ` David Brown
2003-03-20 15:13 ` Xavier Leroy
2003-03-24 11:19   ` Alessandro Baretta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E772105.2000307@baretta.com \
    --to=alex@baretta.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox