From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA18700; Wed, 19 May 2004 09:34:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA18685 for ; Wed, 19 May 2004 09:34:52 +0200 (MET DST) From: thornber@redhat.com Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4J7YpEV027981 for ; Wed, 19 May 2004 09:34:51 +0200 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i4J7YnGG015835; Wed, 19 May 2004 03:34:49 -0400 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i4J7Yj020345; Wed, 19 May 2004 03:34:46 -0400 Received: from localhost (vpn50-22.rdu.redhat.com [172.16.50.22]) by pobox.surrey.redhat.com (8.12.8/8.12.8) with ESMTP id i4J7Yftl031649; Wed, 19 May 2004 08:34:44 +0100 Received: from localhost ([127.0.0.1] helo=nimzo) by localhost with smtp (Exim 4.21) id 1BQLbT-0008AK-Bu; Wed, 19 May 2004 08:35:03 +0100 Received: by nimzo (sSMTP sendmail emulation); Wed, 19 May 2004 08:35:03 +0100 Date: Wed, 19 May 2004 08:35:03 +0100 To: Evan Martin Cc: SWAMPY , caml-list Subject: Re: [Caml-list] Functional critical section Message-ID: <20040519073503.GB29514@nimzo> References: <1084869517.19838.409.camel@pelican.wigram> <20040518090635.GA6918@bourg.inria.fr> <1084875941.19838.446.camel@pelican.wigram> <20040518121147.GA20094@redhat.com> <1084910535.30471.49.camel@ice.gerd-stolpmann.de> <006801c43d14$61edef40$10015c0a@word> <20040518203944.GA25349@lulu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040518203944.GA25349@lulu> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 40AB0E1B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 evan:01 0700,:01 exception:02 wrote:03 let:04 let:04 functions:05 redhat:05 probably:05 functional:06 mutex:06 mutex:06 throws:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, May 18, 2004 at 01:39:44PM -0700, Evan Martin wrote: > Sure, that's the sort of thing that anonymous functions are great for. > > let criticial f = > Mutex.lock someMutex; > let tmp = f () in > Mutex.unlock someMutex; > tmp If f throws an exception the mutex will not get unlocked, which is probably not what you wanted. - Joe ------------------- 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