caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: nadji@noos.fr
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Native Threads
Date: Sun, 13 Oct 2002 10:43:53 +0200	[thread overview]
Message-ID: <20021013104353.G13771@pauillac.inria.fr> (raw)
In-Reply-To: <3DA01AAF.14FD242C@noos.fr>; from nadji@noos.fr on Sun, Oct 06, 2002 at 01:12:47PM +0200

> 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


  parent reply	other threads:[~2002-10-13  8:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-06 11:12 nadji
2002-10-06 11:35 ` Sven LUTHER
2002-10-06 14:34 ` Alessandro Baretta
2002-10-06 15:02   ` nadji
2002-10-13  8:43 ` Xavier Leroy [this message]
2002-10-13  9:04   ` Sven LUTHER
2002-10-13 10:42     ` Stefano Zacchiroli
2002-10-13 11:26       ` Sven LUTHER
2002-10-13 10:45   ` nadji
2002-10-13 15:21     ` Alessandro Baretta
2002-10-13 15:26       ` nadji

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=20021013104353.G13771@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=nadji@noos.fr \
    /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).