On Wed, Sep 12, 2012 at 04:55:29PM +0200, Carmelo AMOROSO wrote: > From: Filippo ARCIDIACONO <[email protected]> > > Current implementation of I/O locking macros using futexes are not > cancel safe, as if a thread is cancelled while doing IO operations, > it does not release the lock on the IO stream. So following > attempts to acquire the IO stream's lock would dead-lock. > In order to make it cancel-safe, it needs to rely upon the > pthread_cleanup push & pop protocol, as it is already done for > the pthread_mutex counterpart.
This is an unnecessarily heavy approach. Cancellation cannot be acted upon unless a call to a cancellation point is made, so you do not need to install cleanup handlers whenever the file is locked, only when cancellable actions will be performed under lock, i.e. when the buffer needs to be flushed or filled. Perhaps it matters less with NPTL's exception-based cancellation, but I still think it's worth considering. Rich _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
