mirror of
https://github.com/fluencelabs/musl
synced 2025-06-21 02:31:50 +00:00
don't use pthread_once when there is no danger in race
This commit is contained in:
@ -71,8 +71,11 @@ static void init_cancellation()
|
|||||||
|
|
||||||
int pthread_cancel(pthread_t t)
|
int pthread_cancel(pthread_t t)
|
||||||
{
|
{
|
||||||
static pthread_once_t once;
|
static int init;
|
||||||
pthread_once(&once, init_cancellation);
|
if (!init) {
|
||||||
|
init_cancellation();
|
||||||
|
init = 1;
|
||||||
|
}
|
||||||
a_store(&t->cancel, 1);
|
a_store(&t->cancel, 1);
|
||||||
return pthread_kill(t, SIGCANCEL);
|
return pthread_kill(t, SIGCANCEL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user