Browse thread
The best way to circumvent the lack of Thread.kill ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-11-02 (16:24) |
From: | Alessandro Baretta <a.baretta@b...> |
Subject: | Re: [Caml-list] The best way to circumvent the lack of Thread.kill ? |
David Teller wrote: > I would have figured that the best way to properly kill a thread would > be to have some form of channel (i.e. Events.t)-based communication > between threads -- and then killing the channel. > > Trouble is that, as I've just realized, there is no such facility as > killing/sending an exception through a channel. Does anyone know why ? Event.channel is a type constructor which takes an argument identifying the type of objects that are sent over the channel. You can send thunk computations ((unit -> 'a) Event.channel), which may very well raise an exception. Or you can simply send an exception (exn Event.channel). Finally, you can send "()" on a channel (unit Event.channel), whose sole purpose is to communicate soft-kill requests. Alex