English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
features of PCRE-OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-11 (17:29)
From: Markus Mottl <mottl@m...>
Subject: Re: features of PCRE-OCaml
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:


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