From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 5944CBC3F for ; Fri, 29 Oct 2004 18:39:10 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9TGd9UQ014778 for ; Fri, 29 Oct 2004 18:39:10 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA16463 for ; Fri, 29 Oct 2004 18:39:09 +0200 (MET DST) Received: from web40611.mail.yahoo.com (web40611.mail.yahoo.com [66.218.78.148]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id i9TGd8r4001895 for ; Fri, 29 Oct 2004 18:39:08 +0200 Message-ID: <20041029163907.36287.qmail@web40611.mail.yahoo.com> Received: from [65.57.245.11] by web40611.mail.yahoo.com via HTTP; Fri, 29 Oct 2004 09:39:07 PDT Date: Fri, 29 Oct 2004 09:39:07 -0700 (PDT) From: Ker Lutyn Subject: atomicity guarantees for threaded code To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 4182722D.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4182722C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 thread:02 thread:02 string:03 module:03 let:03 let:03 mutex:03 threaded:03 threaded:03 example:10 add:14 use:16 promotions:82 there:17 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: 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