pg_atomic_exchange_u32() in ProcArrayGroupClearXid()

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема pg_atomic_exchange_u32() in ProcArrayGroupClearXid()
Дата
Msg-id CAPpHfdtxLsC-bqfxFcHswZ91OxXcZVNDBBVfg9tAWU0jvn1tQA@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_atomic_exchange_u32() in ProcArrayGroupClearXid()  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
Hi!

While investigating ProcArrayGroupClearXid() code I wonder why do we have this loop instead of plain pg_atomic_exchange_u32() call?  Is it intentional?

/*
* Now that we've got the lock, clear the list of processes waiting for
* group XID clearing, saving a pointer to the head of the list.  Trying
* to pop elements one at a time could lead to an ABA problem.
*/
while (true)
{
nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst,
   &nextidx,
   INVALID_PGPROCNO))
break;
}

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: prefix function
Следующее
От: Sergei Kornilov
Дата:
Сообщение: Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru