More on memory barriers
Geoffrey Keating
geoffk@apple.com
Wed Sep 15 19:56:00 GMT 2004
On 15/09/2004, at 11:35 AM, Benjamin Kosnik wrote:
>
>> Hmm? Why do we need the read barrier on the initialization path? I
>> would
>> expect the mutex to provide enough of a read barrier.
>
> Yes, this is something that I don't understand either. RTH tried to
> explain this to me a bit ago but I confess I didn't get it, but some of
> that might have been due to the confusion between atomic locking and
> mutex locking in that discussion.
>
> Maybe Richard could try that explanation again?
My understanding is that the problem is that one code path is not
protected by the mutex, the case where the object is already
initialised. So you have to do something to prevent a processor from
speculatively executing that code path while the code protected by the
mutex is running in a different processor.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2408 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20040915/ec0ceac2/attachment.p7s>
More information about the Gcc
mailing list