diff options
| author | Rich Felker <dalias@aerifal.cx> | 2011-04-13 20:47:01 -0400 | 
|---|---|---|
| committer | Rich Felker <dalias@aerifal.cx> | 2011-04-13 20:47:01 -0400 | 
| commit | 9beb6330c08839e8bb2ebcd129c97c395d9d327e (patch) | |
| tree | ebd39cb4fae2cc1116adca1d38ae539be705e8ec /src/thread/pthread_create.c | |
| parent | 19c1830eaaab05652d87b5ee9557d0d7a40c2f06 (diff) | |
| download | musl-9beb6330c08839e8bb2ebcd129c97c395d9d327e.tar.gz | |
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.
Diffstat (limited to 'src/thread/pthread_create.c')
| -rw-r--r-- | src/thread/pthread_create.c | 15 | 
1 files changed, 2 insertions, 13 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index acbd5a41..a7826504 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -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()  | 
