Pavan Deolasee napsal(a):
> On Thu, Dec 11, 2008 at 5:01 PM, Zdenek Kotala <Zdenek.Kotala@sun.com> wrote:
>> IIRC, Memory reading/writing is atomic operation. Only one CPU(hw thread)
>> can access to the same memory address(es)* in same time*. The question is
>> how compiler compile C code to assembler. But this code seems to me safe.
>
> Yeah, I think the code is safe because we are just reading a bit.
>
> BTW, I wonder if we need to acquire EXCLUSIVE lock while writing the
> visibility map bit ?
Yes, because it is not simple write operation. You need to read byte from memory
to register, set bit and write it back. Write memory itself is atomic but
somebody could change other bits between read and write.
Zdenek