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
History
Tip revision: 9074e41dbd41bc45ef79aeac1b6496bf087509a7 authored by Andres Freund on 31 July 2015, 18:50:35 UTC
Micro optimize LWLockAttemptLock() a bit.
Tip revision: 9074e41
File Mode Size
config
contrib
doc
src
.dir-locals.el -rw-r--r-- 738 bytes
.gitattributes -rw-r--r-- 1.7 KB
.gitignore -rw-r--r-- 428 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 3.6 KB
HISTORY -rw-r--r-- 283 bytes
Makefile -rw-r--r-- 1.5 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 727 bytes
aclocal.m4 -rw-r--r-- 385 bytes
configure -rwxr-xr-x 450.6 KB
configure.in -rw-r--r-- 71.5 KB

README

back to top