[Bug nptl/20730] Need a way to tell pthread_cancel and pthread_exit don't do the forced unwind
fweimer at redhat dot com
sourceware-bugzilla@sourceware.org
Mon Oct 24 09:36:00 GMT 2016
https://sourceware.org/bugzilla/show_bug.cgi?id=20730
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Bai Yang from comment #2)
> (In reply to Florian Weimer from comment #1)
> > Could you provide more information why you need this?
> >
> > If we add such a function, it would be essentially broken, leaking resources
> > and generally leaving the process in an undefined state, just like
> > TerminateThread on Windows or java.lang.Thread#stop() on Java.
>
> Yes, at least two reasons:
> 1. "kill a thread" is none involved with c++ exceptions, it disturb the
> normal exception filtering, catching and processing job. I only see glibc do
> this, others libc on linux and others OS seems all don't do that.
Something like it is required that you can write cancellation handlers using
the C++ unwind mechanism.
Adding the function you request would break that.
> 2. At least in some cases, We want cancel doing a dirty quick abnormal
> termination for thread, we don't want it execute every distructor of the
> object because it may be block few minutes, even few hours, e.g.: disconnect
> from a remote mysql server which network cable has been cutting off.
This is really a fringe case. Most applications would not be able to cope with
the resource leaks (memory and file descriptors). If resource consumption does
not matter, you could just not cancel the thread at all.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list