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
[Caml-list] printable digest strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-05-07 (08:58)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Wserver: Values of global variables lost

On Sun, May 06, 2001 at 08:56:48PM +0200, Mattias Waldau wrote:

> I am trying to use wserver, and create a simple ocaml-based webserver.
> I am using it locally, and I assumed that the global variables in my ocaml 
> would be kept during the interaction with the user.
> However, in the following program sofar is always ref "".

It is because a new process is launched at every request. Wserver uses
the Unix.fork function which creates a separated process, the global
variables are therefore not shared.

It would have worked if Wserver had used the threads but it it not
implemented like that.

To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr