|
Message-ID: <20230517111728.sv3o2fa6d272cqbo@gen2.localdomain> Date: Wed, 17 May 2023 17:17:28 +0600 From: NRK <nrk@...root.org> To: musl@...ts.openwall.com Subject: Re: Question:Why musl call a_barrier in __pthread_once? On Wed, May 17, 2023 at 06:07:09PM +0800, 847567161 wrote: > Why musl add a_barrier() in if branch here? It's explained in the comment: | but ensure that effects of the init routine are visible to the caller. > What happend if we remove it? Could you give me more details? If you remove the barrier, then the calling code may not see the effects of the init function, especially on cpus with "relaxed" memory ordering. Which leads me to the question, are you familiar with cpu memory ordering? If not, I'd recommend reading this: https://research.swtch.com/hwmm One more thing, what's the motivation behind trying to remove the barrier in the first place? - NRK
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.