]> granicus.if.org Git - postgresql/commit
Remove duplicate reads from the inner loops in generic atomic ops.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Sep 2017 18:06:09 +0000 (14:06 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Sep 2017 18:06:09 +0000 (14:06 -0400)
commite530be96859eb0a0e0bab98a79029268ddc98a1d
tree5ec1ed0dd13ddf41336a18682993d3f25925227f
parent34ae182833a4f69ad5d93f06588665a918ee5b03
Remove duplicate reads from the inner loops in generic atomic ops.

The pg_atomic_compare_exchange_xxx functions are defined to update
*expected to whatever they read from the target variable.  Therefore,
there's no need to do additional explicit reads after we've initialized
the "old" variable.  The actual benefit of this is somewhat debatable,
but it seems fairly unlikely to hurt anything, especially since we
will override the generic implementations in most performance-sensitive
cases.

Yura Sokolov, reviewed by Jesper Pedersen and myself

Discussion: https://postgr.es/m/7f65886daca545067f82bf2b463b218d@postgrespro.ru
src/include/port/atomics/generic.h