From: Ker Lutyn <ker527mail@yahoo.com>
To: caml-list@inria.fr
Subject: atomicity guarantees for threaded code
Date: Fri, 29 Oct 2004 09:39:07 -0700 (PDT) [thread overview]
Message-ID: <20041029163907.36287.qmail@web40611.mail.yahoo.com> (raw)
Are there any guarantees for atomicity in threaded OCaml code? Or must I always
use a mutex? For example:
module StringMap = Map.Make (String)
let mapref = ref StringMap.empty
thread 1:
mapref := StringMap.add key value !mapref
thread 2 through thread N:
let value = StringMap.find key !mapref
Assume only thread 1 can update the reference. Is this code safe?
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
next reply other threads:[~2004-10-29 16:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-29 16:39 Ker Lutyn [this message]
2004-10-29 21:50 ` [Caml-list] " David Brown
2004-10-29 23:54 ` skaller
2004-10-30 0:32 ` David Brown
2004-10-30 1:07 ` skaller
2004-10-30 2:07 ` David Brown
2004-10-30 2:36 ` skaller
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=20041029163907.36287.qmail@web40611.mail.yahoo.com \
--to=ker527mail@yahoo.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