|
Message-ID: <tencent_AB6D68C5E505BB0AB73CAFC159C6F7E47D0A@qq.com> Date: Wed, 17 May 2023 18:07:09 +0800 From: "847567161" <847567161@...com> To: "musl" <musl@...ts.openwall.com> Subject: Question:Why musl call a_barrier in __pthread_once? Hi, Why musl add a_barrier() in if branch here? What happend if we remove it? Could you give me more details? int __pthread_once(pthread_once_t *control, void (*init)(void)) { /* Return immediately if init finished before, but ensure that * effects of the init routine are visible to the caller. */ if (*(volatile int *)control == 2) { a_barrier(); return 0; } return __pthread_once_full(control, init); } https://gitee.com/openharmony/third_party_musl/blob/master/src/thread/pthread_once.c#L44 Chuang Yin
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.