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 SAA27477 for caml-red; Mon, 11 Dec 2000 18:29:01 +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 EAA05726 for ; Sat, 9 Dec 2000 04:03:25 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eB933Ob00799 for ; Sat, 9 Dec 2000 04:03:24 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id EAA16296; Sat, 9 Dec 2000 04:03:15 +0100 (MET) Date: Sat, 9 Dec 2000 04:03:15 +0100 From: Markus Mottl To: Gerd Stolpmann Cc: Miles Egan , OCAML Subject: Re: features of PCRE-OCaml Message-ID: <20001209040315.D26367@miss.wu-wien.ac.at> References: <20001206015139.D31140@miss.wu-wien.ac.at> <00120813571607.00625@ice> <20001208160507.A22011@miss.wu-wien.ac.at> <00120816434509.00625@ice> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <00120816434509.00625@ice>; from gerd@gerd-stolpmann.de on Fri, Dec 08, 2000 at 16:40:53 +0100 Sender: weis@pauillac.inria.fr Gerd Stolpmann schrieb am Friday, den 08. December 2000: > 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: Ok, I have found an article by Xavier on these functions: http://caml.inria.fr/archives/199905/msg00035.html So if I am not mistaken, a function that calls the GC or allocates memory on the OCaml-heap cannot be considered reentrant even if its semantics is otherwise referentially transparent. This means that just "tagging" a function as "pure" is no guarantee that it won't mess up the runtime when e.g. calling the GC concurrently - right? In other terms I can put those functions around the largest section of C-code that doesn't interfere with the OCaml-runtime system - then I should be safe. The only question now is: would it really pay for pattern matching in the PCRE? I have taken a look at the implementation of these functions and on their use, but have only found cases where some function really blocks for either an indefinite (e.g. read) or at least potentially very long amount of time (e.g. gethostbyaddr, which might need to contact a nameserver). Without threads we won't benefit, anyway, and if we use threads, there is a small overhead associated with calling these functions. Pattern matching maybe does not eat up so much time in the average case that this is justified. Any experiences or suggestions when using these functions is advisable? - Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl