caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: oliver <oliver@first.in-berlin.de>
To: Matej Kosik <kosik@fiit.stuba.sk>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Thread.exit
Date: Sat, 17 Dec 2011 21:37:08 +0100	[thread overview]
Message-ID: <20111217203708.GB1769@siouxsie> (raw)
In-Reply-To: <4EEC9990.3000102@fiit.stuba.sk>

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

      reply	other threads:[~2011-12-17 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17 13:30 Matej Kosik
2011-12-17 20:37 ` oliver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111217203708.GB1769@siouxsie \
    --to=oliver@first.in-berlin.de \
    --cc=caml-list@inria.fr \
    --cc=kosik@fiit.stuba.sk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).