Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Sep 2009 09:30:34 -0400
From:      Ryan Stone <rysto32@gmail.com>
To:        Robert Noland <rnoland@freebsd.org>
Cc:        attilio@freebsd.org, hackers@freebsd.org, Fabio Checconi <fabio@freebsd.org>
Subject:   Re: sx locks and memory barriers
Message-ID:  <bc2d970909250630x3143cbb6k6be2b84e33455ac6@mail.gmail.com>
In-Reply-To: <1253877997.2031.2627.camel@balrog.2hip.net>
References:  <20090924224935.GW473@gandalf.sssup.it> <1253877997.2031.2627.camel@balrog.2hip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bc2d970909250630x3143cbb6k6be2b84e33455ac6>