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:01)
From: Gerd Stolpmann <gerd@g...>
Subject: Re: features of PCRE-OCaml
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

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;
    ret = read(Int_val(fd), iobuf, (int) numbytes);
    if (ret == -1) uerror("read", Nothing);
    bcopy(iobuf, &Byte(buf, Long_val(ofs)), ret);
  return Val_int(ret);

Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de