summaryrefslogtreecommitdiff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-17 12:15:55 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-17 12:15:55 -0400
commit02eff258c6a39746db287e20c142153e80c81bac (patch)
treeb0e258754963d680de74afcbb902e733f5fa87e9 /src/thread
parente74664016b025ea9718da59e680555961444ee4d (diff)
downloadmusl-02eff258c6a39746db287e20c142153e80c81bac.tar.gz
don't use pthread_once when there is no danger in race
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/cancel_impl.c7
1 files changed, 5 insertions, 2 deletions
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);
}