sx locks and memory barriers

Robert Noland rnoland at FreeBSD.org
Fri Sep 25 14:40:29 UTC 2009


On Fri, 2009-09-25 at 09:30 -0400, Ryan Stone wrote:
> The code that Fabio proposes looks like this:
> 
> sx_slock(&data->lock);
> if (data->buffer)
>     a = *data->buffer;
> sx_sunlock(&data->lock);
> 
> 
> This point is that without a memory barrier on the unlock, the CPU is
> free to reorder the instructions into the order is his message.

Ok, then I will sit back and wait for someone with more clue to
respond...

robert.

-- 
Robert Noland <rnoland at FreeBSD.org>
FreeBSD



More information about the freebsd-hackers mailing list