From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C12BAD45F for ; Wed, 2 Nov 2005 17:24:30 +0100 (CET) Received: from mail.barettadeit.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA2GOTPC005331 for ; Wed, 2 Nov 2005 17:24:30 +0100 Received: from [192.168.1.10] (baretta_sangiuliano [82.105.173.52]) by mail.barettadeit.com (Postfix) with ESMTP id BC1B484141; Wed, 2 Nov 2005 17:28:47 +0100 (CET) Message-ID: <4368E835.7090501@barettadeit.com> Date: Wed, 02 Nov 2005 17:24:21 +0100 From: Alessandro Baretta User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David.Teller@ens-lyon.org Cc: OCaml Subject: Re: [Caml-list] The best way to circumvent the lack of Thread.kill ? References: <43688C4C.2080606@inria.fr> <1130943226.4565.11.camel@calaf.rn.informatics.scitech.susx.ac.uk> In-Reply-To: <1130943226.4565.11.camel@calaf.rn.informatics.scitech.susx.ac.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4368E83D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 baretta:01 caml-list:01 threads:01 computations:01 exn:01 wrote:01 exception:01 exception:01 constructor:01 argument:01 thread:02 thread:02 objects:02 unit:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 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