Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-15 08:38:12


From: "David Abrahams" <david.abrahams_at_[hidden]>
> <<"There are several important blocking routines
> that are specifically not made cancelation points:
> — pthread_mutex_lock()
> If pthread_mutex_lock( ) were a cancelation point,
> every routine that called it would also become a
> cancelation point (that is, any routine that touched
> shared state would automatically become a cancelation
> point). For example, malloc(), free( ), and rand()
> would become cancelation points under this scheme. >>
>
> I think free() in particular would be a particularly bad one. It's
basically
> the same issue as "what operations should be allowed to throw?" However, I
> think that a C++ library can afford to be much more liberal with
> cancellation points than a C library can in general, because C++
programmers
> are (at least starting to become) aware of the presence of exceptions. I
> guess I would support making mutex locking a cancellation point as long as
> the important operations which used it(e.g. free(), operator delete(),
> rand()) disabled cancellation.

FWIW I agree with Dave. Exception safety is orthogonal to cancellation, and
we should not design a crippled thread cancellation out of fear that
programmers write exception unsafe code.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk