This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #13613] Allow a single-threaded process to cancel itself
On 9 May 2012 21:00, Carlos O'Donell <carlos@systemhalted.org> wrote:
> * After calling pthread_cancel() *all* of the optimizations that could
> have used SINGLE_THREAD_P are not available, not just those related to
> cancellation.
This should not make a difference, because a single thread cancelling
itself means that the process will end after unwind. For any
multi-threaded situation this does not make any difference since the
value was already 1.
> * It overloads multiple_threads with a new meaning i.e. "Is true if
> either more than one thread is running or if the one thread called
> pthread_cancel()", which is bad for maintainability.
I agree. I think a union like:
union
{
int __multiple_threads;
int __enable_cancellation_points;
} cancellation;
#define multiple_threads cancellation.__multiple_threads
#define enable_cancellation_points
cancellation.__enable_cancellation_points
this should work. Let me check.
--
Siddhesh Poyarekar
http://siddhesh.in