sx locks and memory barriers

Ryan Stone rysto32 at gmail.com
Fri Sep 25 13:57:02 UTC 2009


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.


More information about the freebsd-hackers mailing list