From 9beb6330c08839e8bb2ebcd129c97c395d9d327e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 13 Apr 2011 20:47:01 -0400 Subject: simplify cancellation point handling we take advantage of the fact that unless self->cancelpt is 1, cancellation cannot happen. so just increment it by 2 to temporarily block cancellation. this drops pthread_create.o well under 1k. --- src/thread/pthread_setcancelstate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/thread/pthread_setcancelstate.c') diff --git a/src/thread/pthread_setcancelstate.c b/src/thread/pthread_setcancelstate.c index a85cc800..aa0ddcdd 100644 --- a/src/thread/pthread_setcancelstate.c +++ b/src/thread/pthread_setcancelstate.c @@ -3,8 +3,8 @@ int pthread_setcancelstate(int new, int *old) { struct pthread *self = pthread_self(); - if (old) *old = self->canceldisable & 1; - if ((unsigned)new > 1) return EINVAL; - self->canceldisable = (self->canceldisable & ~1) | new; + if (old) *old = self->canceldisable; + if (new > 1U) return EINVAL; + self->canceldisable = new; return 0; } -- cgit v1.2.1