* [Caml-list] Thread.exit
@ 2011-12-17 13:30 Matej Kosik
2011-12-17 20:37 ` oliver
0 siblings, 1 reply; 2+ messages in thread
From: Matej Kosik @ 2011-12-17 13:30 UTC (permalink / raw)
To: caml-list
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.
It is not a big problem, but I think this is unnecessary constraint and
if removed, I could simply write:
let bits = try receive ()
with Channel.End -> close ();
Thread.exit ()
in
(i.e. without confusing bogus calls)
Maybe I am just too sensitive, but I would still be interested in these
small improvements, if they make sense.
Regards,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Thread.exit
2011-12-17 13:30 [Caml-list] Thread.exit Matej Kosik
@ 2011-12-17 20:37 ` oliver
0 siblings, 0 replies; 2+ messages in thread
From: oliver @ 2011-12-17 20:37 UTC (permalink / raw)
To: Matej Kosik; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-17 20:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-17 13:30 [Caml-list] Thread.exit Matej Kosik
2011-12-17 20:37 ` oliver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox