Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

Browse thread
what is the error???
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-28 (03:30)
From: Remi VANICAT <vanicat+egroups@l...>
Subject: Re: "ocaml_beginners"::[] what is the error???
"animesh_pathak" <a_pathak@r...> writes:

> hello people,
> I am new to ocaml.. when i tried this code.. it compiled perfectly
> fine but when i ran it.. it gave me *no* output at all!! it just
> ended... can you please find out what's wrong
>
> Thanks.
> -animesh
>
> (*the code starts*)
> let lock l = 
> Mutex.lock l;
> print_string "locked the mutex\n"
>
> let unlock m =
> Mutex.unlock m;
> print_string "unlocked the mutex\n"
>
> let main()=
> print_string "started\n";
> let m1= Mutex.create() in
> lock m1;
> unlock m1
>
> let _ = Thread.create main ();
> exit 0 

the exit 0 is (probably) executed before the newly created thread, an
so exit the program and all its threads (before the thread have
any chance of being run).

-- 
Rémi Vanicat
vanicat@l...
http://dept-info.labri.u-bordeaux.fr/~vanicat