From: Dave Butenhof <butenhof@softtail.zko.dec.com>
Subject: Re: HOW-TO KILL THREADS
Date: 1997/11/03 [thread overview]
Message-ID: <345DCB95.48AB08DF@softtail.zko.dec.com> (raw)
In-Reply-To: 636h7d$7al$0@207.16.238.216
Richard Spangenberg wrote:
>
> Thank you for the resonse. I know that IBM and POSIX do allow this through
> the pthread_kill command. Databases like MYSQL and PostgreSQL seem to want
> this capability. AIX 4.# has pthread_kill(), so IBM later noticed that the
> command was needed, etc.
As I said, OSF/1 3.2 didn't have POSIX threads, and therefore lacked
pthread_kill -- which was added to a later draft. IBM 4.x (up through
4.3, which has POSIX threads) implemented "draft 7" of the POSIX
standard: not quite as archaic as draft 4 (on which DCE threads was
based), but still a long way from POSIX threads.
The question of whether pthread_kill exists or not, however, has no
bearing on the main point of my message, which is that killing a
misbehaving thread is NOT, in general, going to leave the process in a
reliable (or predictable) state.
However, as established in private mail, (and for the benefit of other
readers who weren't party to those messages!), it turns out that the
problem was misstated. Richard is NOT trying to kill randomly "stuck"
threads. Rather, they know that the thread is blocked in a syscall,
(e.g., reading from a socket), and wish to abort that syscall so the
thread can voluntarily process an "abort" request (a flag set in shared
state). The pthread_kill function is just fine for that case. It will
"break through" the read, causing it to return with EINTR, after which
the calling thread can check whether it ought to abort. No problem.
> Your explaination sounds well informed, however, and my understanding is
> only marginal. I bow to your expertise and thank you. It certainly seems
> correct for dec/alpha.
A correct answer to an incorrect question may nevertheless be
misleading!
/---------------------------[ Dave Butenhof ]--------------------------\
| Digital Equipment Corporation butenhof@zko.dec.com |
| 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof |
| Nashua NH 03062-2698 http://www.awl.com/cseng/titles/0-201-63392-2/ |
\-----------------[ Better Living Through Concurrency ]----------------/
prev parent reply other threads:[~1997-11-03 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-27 5:00 HOW-TO KILL THREADS Richard Spangenberg
1997-10-28 5:00 ` Dave Butenhof
1997-10-28 5:00 ` Brian Silver
1997-10-29 5:00 ` Richard Spangenberg
1997-11-03 5:00 ` Dave Butenhof [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox