From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D3149BB91 for ; Sun, 9 Jan 2005 21:57:30 +0100 (CET) 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 j09KvUq9018807 for ; Sun, 9 Jan 2005 21:57:30 +0100 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 VAA27382 for ; Sun, 9 Jan 2005 21:57:30 +0100 (MET) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.190]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j09KvTQ1018804 for ; Sun, 9 Jan 2005 21:57:29 +0100 Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1Cnk7p-0003aT-00; Sun, 09 Jan 2005 21:57:25 +0100 Received: from [80.129.123.254] (helo=gate.gerd-stolpmann.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1Cnk7p-0006pG-00; Sun, 09 Jan 2005 21:57:25 +0100 Received: from ice.gerd-stolpmann.de (ice [192.168.0.13]) by gate.gerd-stolpmann.de (Postfix) with ESMTP id 14EC6C04E; Sun, 9 Jan 2005 21:57:25 +0100 (CET) Received: by ice.gerd-stolpmann.de (Postfix, from userid 1000) id 19895B037; Sun, 9 Jan 2005 21:57:00 +0100 (CET) Subject: Re: [Caml-list] Thread safe Str From: Gerd Stolpmann To: Christophe TROESTLER Cc: "O'Caml Mailing List" In-Reply-To: <20050109.203010.110660321.Christophe.Troestler@umh.ac.be> References: <20050109.203010.110660321.Christophe.Troestler@umh.ac.be> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1105304219.15577.27.camel@ice.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 09 Jan 2005 21:57:00 +0100 X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:a6865a839c0178d9aa0ce41878507ea2 X-Miltered: at concorde with ID 41E19ABA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41E19AB9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 gerd:01 stolpmann:01 christophe:01 troestler:01 wrote:01 lgpl:01 pcre:01 regexp:01 netstring:01 ocamlnet:01 thread-safe:01 netstring:01 pcre:01 regexp:01 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 Son, 2005-01-09 at 20:30, Christophe TROESTLER wrote: > Hi, > > The new Str module not only made it LGPL but also very fast (100% more > than Pcre in some cases). However it is still not thread safe -- and > it is not possible given its interface. However, from a quick look, > it seems to me that what is under the hood is almost thread safe. So > why not to write a new module (say Regexp) which would be thread safe > and on top of which Str would be build? This would not be too much > work, would it? The Netstring_str module (part of ocamlnet) does it the other way round: The thread-safe interface is built on top of a potentially unsafe implementation. Although the current version of Netstring_str uses Pcre as its implementation, there is a historic version on top of Str. This other way of layering can be made working because there is the global master lock protecting the C parts of the regexp engine. The interface of Netstring_str: http://ocamlnet.sourceforge.net/manual/refman/Netstring_str.html Of course, this is not the optimal solution, I would prefer it the way you suggest. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de ------------------------------------------------------------