On 06/14/2010 02:41 AM, Paul E. McKenney wrote:
The compiler (and sometimes the CPU) are within their rights to move code into a lock-based critical section. With two locks:do_first_thing(); acquire_lock(); release_lock(); acquire_lock(); release_lock(); do_second_thing(); the worst that the compiler and CPU can do is: acquire_lock(); do_first_thing(); release_lock(); acquire_lock(); do_second_thing(); release_lock(); which is still acting like a memory barrier.
Interesting, so it's actually the release+acquire that is doing the job. I thought about barrier+acquire+release+barrier, but that would placate the compiler only, not the CPU.
Paolo _______________________________________________ ltt-dev mailing list [email protected] http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
