https://github.com/postgres/postgres
Revision 9074e41dbd41bc45ef79aeac1b6496bf087509a7 authored by Andres Freund on 31 July 2015, 18:50:35 UTC, committed by Andres Freund on 02 August 2015, 16:41:41 UTC
LWLockAttemptLock pointlessly read the lock's state in every loop
iteration, even though pg_atomic_compare_exchange_u32() returns the old
value. Instead do that only once before the loop iteration.

Additionally there's no need to have the expected_state variable,
old_state mostly had the same value anyway.

Noticed-By: Heikki Linnakangas
Backpatch: 9.5, no reason to let the branches diverge at this point
1 parent 27b7191
Raw File
Tip revision: 9074e41dbd41bc45ef79aeac1b6496bf087509a7 authored by Andres Freund on 31 July 2015, 18:50:35 UTC
Micro optimize LWLockAttemptLock() a bit.
Tip revision: 9074e41
HISTORY
Release notes for all versions of PostgreSQL can be found on-line at
http://www.postgresql.org/docs/current/static/release.html

Distribution file sets include release notes for their version and preceding
versions.  Visit the file doc/src/sgml/html/release.html in an HTML browser.
back to top