Browse thread
atomicity guarantees for threaded code
- Ker Lutyn
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Ker Lutyn <ker527mail@y...> |
| Subject: | atomicity guarantees for threaded code |
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