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] 'global' variables
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-28 (11:54)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] 'global' variables
Animesh Pathak <animesh.pathak@inria.fr> writes:

> dear members,
> Is it possible for two threads to share data by using a global variable and 
> *not* giving it to a thread as an argument??
> Please send me a small example to illustrate the same.

as in :

let var = "string"

let f () = print_endline var; print_endline "thread"

let _ = Thread.create f ()

let _ = print_endline var

(by the way, var may be a reference, or anything).

Rémi Vanicat
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners