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
This archive was generated by hypermail 2b29 : Thu May 11 2000 - 14:58:31 MET DST