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-Tag: v0.7.9~37 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=02eff258c6a39746db287e20c142153e80c81bac;p=oweals%2Fmusl.git 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); }