[libdispatch-dev] lib dispatch worker threads may loop depending on compiler optimization
Paolo Bonzini
bonzini at gnu.org
Fri Sep 9 10:30:02 PDT 2011
On 09/09/2011 05:49 PM, Dave Zarzycki wrote:
>>> No, it didn't. Really, believe me, unlike you I can follow GCC
>>> development.;)
>
> If putting asm("" ::: "memory") before __sync_lock_test_and_set()
> fixes the bug, then that proves that GCC no longer considers
> __sync_lock_test_and_set() to be a full barrier.
It is not "no longer". It never did, and it worked by chance.
It doesn't even consider it an acquire barrier, in fact. Even for a
cmpxchg or any other sync builtin, the barrier semantics remain in the
assembly, but are lost for the compiler midway through the compilation.
Paolo
More information about the libdispatch-dev
mailing list