English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
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: -- (:)
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
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~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