From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0B55EBC43 for ; Fri, 29 Oct 2004 23:50:31 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9TLoUi0018270 for ; Fri, 29 Oct 2004 23:50:30 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA27227 for ; Fri, 29 Oct 2004 23:50:30 +0200 (MET DST) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9TLoSNx006055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 29 Oct 2004 23:50:29 +0200 Received: from davidb by mail.davidb.org with local (Exim 4.42 #1 (Debian)) id 1CNedf-0002UR-9M; Fri, 29 Oct 2004 14:50:27 -0700 Date: Fri, 29 Oct 2004 14:50:27 -0700 From: David Brown To: Ker Lutyn Cc: caml-list@inria.fr Subject: Re: [Caml-list] atomicity guarantees for threaded code Message-ID: <20041029215027.GA9504@old.davidb.org> References: <20041029163907.36287.qmail@web40611.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041029163907.36287.qmail@web40611.mail.yahoo.com> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 4182BB26.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4182BB24.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 caml-list:01 wrote:01 threads:01 thread:02 thread:02 let:03 threaded:03 long:04 entries:05 fri:05 probably:05 suspect:07 dave:08 might:10 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.0 X-Spam-Level: On Fri, Oct 29, 2004 at 09:39:07AM -0700, Ker Lutyn wrote: > 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? As long as the reference write is atomic, which it is going to be, I would suspect this is safe. It probably would even be safe if multiple threads updated the reference, but you might just drop entries. Dave