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.
This commit is contained in:
Rich Felker
2011-04-13 20:47:01 -04:00
parent 19c1830eaa
commit 9beb6330c0
2 changed files with 5 additions and 16 deletions

View File

@ -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;
}