From: Rich Felker Date: Sun, 17 Apr 2011 16:15:55 +0000 (-0400) Subject: don't use pthread_once when there is no danger in race X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=02eff258c6a39746db287e20c142153e80c81bac don't use pthread_once when there is no danger in race --- diff --git a/src/thread/cancel_impl.c b/src/thread/cancel_impl.c index 28dc84dc..7bcfaef5 100644 --- a/src/thread/cancel_impl.c +++ b/src/thread/cancel_impl.c @@ -71,8 +71,11 @@ static void init_cancellation() int pthread_cancel(pthread_t t) { - static pthread_once_t once; - pthread_once(&once, init_cancellation); + static int init; + if (!init) { + init_cancellation(); + init = 1; + } a_store(&t->cancel, 1); return pthread_kill(t, SIGCANCEL); }