diff options
author | Andres Freund <andres@anarazel.de> | 2015-07-31 20:50:35 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2015-08-02 18:41:23 +0200 |
commit | a4b09af3e93707351f1d4b8efafabfa135c0f70b (patch) | |
tree | 0ea29a8ec25a8d036f4a376932d5c9ed004dcfa7 /src/backend/access/transam/xlog.c | |
parent | 7039760114da45552043f8fa229928e071650173 (diff) | |
download | postgresql-a4b09af3e93707351f1d4b8efafabfa135c0f70b.tar.gz postgresql-a4b09af3e93707351f1d4b8efafabfa135c0f70b.zip |
Micro optimize LWLockAttemptLock() a bit.
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
Diffstat (limited to 'src/backend/access/transam/xlog.c')
0 files changed, 0 insertions, 0 deletions