From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA16803; Sun, 13 Oct 2002 10:43:55 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA16104 for ; Sun, 13 Oct 2002 10:43:54 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9D8hr517623; Sun, 13 Oct 2002 10:43:53 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA16681; Sun, 13 Oct 2002 10:43:53 +0200 (MET DST) Date: Sun, 13 Oct 2002 10:43:53 +0200 From: Xavier Leroy To: nadji@noos.fr Cc: "caml-list@inria.fr" Subject: Re: [Caml-list] Native Threads Message-ID: <20021013104353.G13771@pauillac.inria.fr> References: <3DA01AAF.14FD242C@noos.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3DA01AAF.14FD242C@noos.fr>; from nadji@noos.fr on Sun, Oct 06, 2002 at 01:12:47PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I've just been playing with threads and I noticed at execution > time that Thread.kill is not implemented by the posix-compiled > version of the library. I used this flag because I thought that > it would be faster (please correct me if I'm wrong), and there > was no mention that Thread.kill would not be implemented. > By looking at the sources, I learned that the reason is > "problems with cleanup handlers on several platforms". > That's fine with me, but I would like to compile my > program :) The documentation should definitely be updated to mention that Thread.kill is not only unavailable with system threads, but also deprecated and definitely not advised. Being able to terminate any thread at any time, without cooperation from the thread, is extremely dangerous: what if the killed thread was holding mutexes? (I think this has been discussed recently on this list.) For this reason, thread APIs either provide a low-level "kill" operation and strongly adivse not to use it (Win32, Java), or they provide a more controlled "cancellation" mechanism (POSIX) that is slightly less risky, but doesn't (currently) map well to Caml threads. So: don't kill threads. Let them live a long and happy life :-) - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners