Use standard compare_exchange loop style in ProcArrayGroupClearXid().

Besides style, this might improve performance in the contended case.

Reviewed by Amit Kapila.

Discussion: https://postgr.es/m/20191015035348.GA4166224@rfd.leadboat.com
This commit is contained in:
Noah Misch 2019-10-18 20:21:10 -07:00
parent 30ee5d17c2
commit 48cc59ed24
1 changed files with 1 additions and 1 deletions

View File

@ -493,9 +493,9 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
/* Add ourselves to the list of processes needing a group XID clear. */
proc->procArrayGroupMember = true;
proc->procArrayGroupMemberXid = latestXid;
nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
while (true)
{
nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
pg_atomic_write_u32(&proc->procArrayGroupNext, nextidx);
if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst,