From: "Mojo Jojo" <mojojojo@pacbell.net>
To: <java-discuss@sourceware.cygnus.com>
Subject: Re: Thread.interrupt() etc
Date: Sat, 01 Apr 2000 00:00:00 -0000 [thread overview]
Message-ID: <00f201bf8f71$20f27420$8407aace@brownell.org> (raw)
Message-ID: <20000401000000.jcpKaMbWpUZZnrWPhDA4InrTxO5e5czdP660WMtsK2c@z> (raw)
I agree with the direction Hans sketched: some common mechanism
seems like it should be able to handle InterruptedException as well as
pthread_cancel() and such. I'm curious how much of that mechanism
exists now, but don't have all the code in hand to figure it out!
- When unwinding a thread stack (for a clean or exceptional exit,
not a "kill") pthreads has a stack of "cleanup" functions to invoke.
Ideally those should be appropriately interleaved with destruction
of C++ stack-resident objects, releasing monitors, executing Java
"finally" clauses, and so on -- each stack frame (and maybe lesser
scopes too) may need specialized cleanup.
Are all those aspects of unwinding now integrated? (I'd guess
that the pthreads cleanup functions aren't, but would be happy
to be wrong!)
- As of Redhat 6.0, "man pthread_cancel" said (BUGS) that many
C library functions (syscalls, printf, etc) aren't cancelation points,
although POSIX says they must be. I don't recall Solaris listing
such bugs, but someone else may know better.
This should affect coding of all LIBGCJ methods calling those library
functions. In LinuxThreads, pthread_cancel() sends a signal, so the
natural implementation of Thread.interrupt() could cause lots of
unexpected EINTR failures, from deep inside the system libraries.
I'd expect that more mature pthreads implementations, e.g. the one
on Solaris, don't have many such issues.
- Does anyone care about async cancelation yet? Analogy: hardware
interrupt, between any two instructions vs only at certain subroutine
calls. There are codegen complications.
If all is done correctly, I think it'll be straightforward for CNI methods
to just call pthread_testcancel(), which would trigger unwinding, maybe
by creating and throwing an InterruptedException. I don't think any C
or C++ code would normally see such exception objects.
Yes, I do agree that it'd be better not to accept the alleged Win32 flaws
except when using Win32 threading ... and even there, likely there's a
workaround available.
next reply other threads:[~2000-04-01 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-16 9:57 Mojo Jojo [this message]
2000-04-01 0:00 ` Mojo Jojo
2000-03-16 10:05 Miles Sabin
2000-04-01 0:00 ` Miles Sabin
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='00f201bf8f71$20f27420$8407aace@brownell.org' \
--to=mojojojo@pacbell.net \
--cc=java-discuss@sourceware.cygnus.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).