This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: catch(...) and forced unwind


Richard Henderson <rth@redhat.com> writes:

> On Sat, Dec 13, 2003 at 08:20:15AM -0500, David Abrahams wrote:
>> > Basically, all of the C library I/O functions are cancellation points.
>> 
>> Well, I constider that very surprising. It harms the ability to write
>> portable code, for reasons explained below.
>
> No.  If you're writing a threaded program that cancels code, then
> I expect that you've *read* POSIX, and thus realize that if you 
> want to output bits via write, and you don't want to be canceled,
> then you should call pthread_setcancelstate(PTHREAD_CANCEL_DISABLE).

Yes.  I would hope that people writing threaded programs could use
libraries written to be generally threadsafe but which don't
specifically prevent posix thread cancellation.

> If you havn't done this, then you aren't using the thread API correctly,
> and thus are *not* writing portable code.

It's not a matter of using the thread API at all; threadsafe libraries
may never touch a thread API function.

> If you don't want to know about pthread_setcancelstate, then you should
> not use pthread_cancel either.  If you never use pthread_cancel, then
> none of this thread is even relevant.

I'm a library provider ;-)

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]