Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@maxtal.com.au>
To: Markus Mottl <mottl@miss.wu-wien.ac.at>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: how to kill native code threads?
Date: Tue, 09 May 2000 15:32:56 +1000	[thread overview]
Message-ID: <3917A308.24B90662@maxtal.com.au> (raw)
In-Reply-To: <200005060009.CAA17778@miss.wu-wien.ac.at>

Markus Mottl wrote:
> 
> Hello,
> 
> the documentation of the "Thread.kill" function says that it only works for
> bytecode-level threads.
> 
> But how can I terminate native threads from outside?

	[This information from a coworker who is expert in threads,
which I am not]

	You can't. There IS supposedly a way to do this in general, 
using Posix thread cancellation. It isn't clear that this will work
correctly
with Ocaml, however, and for this reason it isn't part of the 
threads library. [It also only works on Posix systems].

	Where I work, there is a different problem:
code is written in C++, and when a thread is cancelled,
it is necessary to unwind the stack to execute destructors.
Linux does not do this. I'm told Solaris tries.

	Posix requires certain functions check for cancellation.
Unfortunately, there is a bug in the Posix specification,
such that NOT all blocking calls perform the requisite check.
This means Posix thread cancellation doesn't work properly
in all cases. I can't remember the offending calls off hand,
[connect?] but you need to add a manual check and use a non-blocking
call
in that case.

	Executive summary: there's no simple solution, not even in C.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net




  reply	other threads:[~2000-05-11 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-06  0:09 Markus Mottl
2000-05-09  5:32 ` John Max Skaller [this message]
2000-05-09  8:52 ` Xavier Leroy

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=3917A308.24B90662@maxtal.com.au \
    --to=skaller@maxtal.com.au \
    --cc=caml-list@inria.fr \
    --cc=mottl@miss.wu-wien.ac.at \
    /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