mirror of
https://github.com/fluencelabs/musl
synced 2025-07-03 16:41:59 +00:00
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:
@ -63,19 +63,8 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
|
||||
static void cancelpt(int x)
|
||||
{
|
||||
struct pthread *self = __pthread_self();
|
||||
switch (x) {
|
||||
case 1:
|
||||
self->cancelpoint++;
|
||||
case 0:
|
||||
if (self->cancel && self->cancelpoint==1 && !self->canceldisable)
|
||||
docancel(self);
|
||||
break;
|
||||
case -1:
|
||||
self->cancelpoint--;
|
||||
break;
|
||||
default:
|
||||
self->canceldisable += x;
|
||||
}
|
||||
if ((self->cancelpoint+=x)==1 && self->cancel
|
||||
&& x<2U && !self->canceldisable) docancel(self);
|
||||
}
|
||||
|
||||
static void init_threads()
|
||||
|
Reference in New Issue
Block a user