From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 36668BC75 for ; Wed, 16 Feb 2005 20:06:17 +0100 (CET) Received: from alex.barettalocal.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1GJ6GLV003980 for ; Wed, 16 Feb 2005 20:06:17 +0100 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by alex.barettalocal.com (Postfix) with ESMTP id BE3102BBC7F; Wed, 16 Feb 2005 20:06:17 +0100 (CET) Message-ID: <421399A9.8040206@barettadeit.com> Date: Wed, 16 Feb 2005 20:06:17 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Janne Hellsten Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] interprocess mutex References: <421395A4.3030909@hybrid.fi> In-Reply-To: <421395A4.3030909@hybrid.fi> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 421399A8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 caml-list:01 interprocess:01 wrote:01 ocaml's:01 interprocess:01 ocaml:01 lockf:01 baretta:01 unix:01 module:03 alex:03 alex:03 mutex:03 mutex:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Janne Hellsten wrote: > Hello, > > I need to sequentialize two processes accessing the same GDBM database > (OCaml's dbm library). Since GDBM allows for only one writer at a time, > I need a way to block until the previous writer has finished. I think > there is a way to do this with the original GDBM library since it claims > to handle the file lockings properly -- I could block based on the > returned error codes. However, this functionality does not appear to be > exposed through the Dbm module. > > Of course I can implement this blocking myself with an interprocess > mutex. But how can I implement such a mutex in OCaml? I couldn't find > anything from the standard library that would resemble my problem. Unix.lockf is the way to go. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) The FreerP Project