From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA32124 for caml-red; Mon, 11 Dec 2000 18:01:02 +0100 (MET) 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 QAA10232 for ; Fri, 8 Dec 2000 16:44:39 +0100 (MET) Received: from moutvdom00.kundenserver.de (moutvdom00.kundenserver.de [195.20.224.149]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eB8Ficb19437 for ; Fri, 8 Dec 2000 16:44:38 +0100 (MET) Received: from [195.20.224.204] (helo=mrvdom00.kundenserver.de) by moutvdom00.kundenserver.de with esmtp (Exim 2.12 #2) id 144Pgs-0006XD-00; Fri, 8 Dec 2000 16:44:06 +0100 Received: from drms-3e364b4b.pool.mediaways.net ([62.54.75.75] helo=ice.gerd-stolpmann.de) by mrvdom00.kundenserver.de with esmtp (Exim 2.12 #2) id 144Pgh-00049g-00; Fri, 8 Dec 2000 16:43:55 +0100 Received: from localhost (localhost [[UNIX: localhost]]) by ice.gerd-stolpmann.de (8.9.3/8.9.3) id QAA19740; Fri, 8 Dec 2000 16:43:45 +0100 From: Gerd Stolpmann Reply-To: gerd@gerd-stolpmann.de Organization: privat To: Markus Mottl Subject: Re: features of PCRE-OCaml Date: Fri, 8 Dec 2000 16:40:53 +0100 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain Cc: Miles Egan , OCAML References: <20001206015139.D31140@miss.wu-wien.ac.at> <00120813571607.00625@ice> <20001208160507.A22011@miss.wu-wien.ac.at> In-Reply-To: <20001208160507.A22011@miss.wu-wien.ac.at> MIME-Version: 1.0 Message-Id: <00120816434509.00625@ice> Content-Transfer-Encoding: 8bit Sender: weis@pauillac.inria.fr On Fri, 08 Dec 2000, Markus Mottl wrote: >Gerd Stolpmann schrieb am Friday, den 08. December 2000: >> However, the PCRE stubs can be improved in one point: The master lock could be >> released while the engine executes the regexp. Several threads could then >> use the engine at the same time which would improve the responsiveness of >> multi-threaded programs, and the programs would run faster on SMP systems. > >Are there annotations which one could use to indicate reentrancy of >external functions? This would make it fairly easy to get rid of this >problem. This information could then also be used for program analysis. There are two functions making it easy: enter_blocking_section and leave_blocking_section. For example, the stub for the read syscall of the Unix library: value unix_read(value fd, value buf, value ofs, value len) /* ML */ { long numbytes; int ret; char iobuf[UNIX_BUFFER_SIZE]; Begin_root (buf); numbytes = Long_val(len); if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE; enter_blocking_section(); ret = read(Int_val(fd), iobuf, (int) numbytes); leave_blocking_section(); if (ret == -1) uerror("read", Nothing); bcopy(iobuf, &Byte(buf, Long_val(ofs)), ret); End_roots(); return Val_int(ret); } Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ----------------------------------------------------------------------------