Hello,

On Sat, Dec 17, 2011 at 01:30:56PM +0000, Matej Kosik wrote:
> Hello,
> 
> I use the threads library.
> 
> I would like to ask if
> 
>     Thread.exit
> 
> must have the following type:
> 
>     unit -> unit
> 
> instead of:
> 
>     unit -> 'a
> 
> i.e. the same as the type of Pervasives.exit.
> 
> In my code:
> 
>   let bits = try receive ()
>              with Channel.End -> close ();
>                                  Thread.exit ();
>                                  exit 0
>   in
> 
> I must make a bogus call "exit 0" empty to make the type-checker happy.
> If "Thread.exit" had the same type as "Pervasives.empty", it would
> not be necessary.
[...]

If you have type problems, the surrounding code will await
a type different than unit; "bits" looks like int...

Also you should be aware that Pervasives.exit exits the whole
process, but Threads.exit terminates only the thread.


Ciao,
   Oliver

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to