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 226FBBCA8 for ; Wed, 16 Feb 2005 20:35:13 +0100 (CET) Received: from smtp3.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.28]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1GJZCvL018260 for ; Wed, 16 Feb 2005 20:35:13 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0303.wanadoo.fr (SMTP Server) with ESMTP id BAD8E1C003E5; Wed, 16 Feb 2005 20:35:12 +0100 (CET) Received: from nono (ARouen-106-1-2-22.w217-128.abo.wanadoo.fr [217.128.67.22]) by mwinf0303.wanadoo.fr (SMTP Server) with SMTP id 21C1D1C003EF; Wed, 16 Feb 2005 20:35:12 +0100 (CET) X-ME-UUID: 20050216193512138.21C1D1C003EF@mwinf0303.wanadoo.fr Message-ID: <006301c5145e$e83fbde0$0100a8c0@mshome.net> From: =?iso-8859-1?Q?Fr=E9d=E9ric_Gava?= To: "Janne Hellsten" , References: <421395A4.3030909@hybrid.fi> Subject: Re: [Caml-list] interprocess mutex Date: Wed, 16 Feb 2005 20:37:09 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Miltered: at concorde with ID 4213A070.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; gava:01 gava:01 caml-list:01 interprocess:01 threads:01 ocaml:01 htmlman:01 threads:01 waitpid:01 ocaml's:01 interprocess:01 ocaml:01 doable:01 invocations:01 caml-list:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hi, you could also used threads. It is easier. http://caml.inria.fr/ocaml/htmlman/manual038.html After you could used "Mutex", "Condition" and "Event" to synchronise your threads... To synnchronise true "process", you could used "waitpid". Regards, Frédéric Gava > 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. > > Is it easily doable or do I need to go and start hacking C code? I've > never done it on Unix but I know it's easily done on Windows. > > Thanks in advance, > Janne > > P.S. I'm using GDBM merely as a cache between process invocations, so > using a more heavyweight DB is out of the question. > > > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >