Re: Atomic operations within spinlocks

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Atomic operations within spinlocks
Дата
Msg-id 20200611172653.l5ioa3uzsbazikw3@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Atomic operations within spinlocks  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Atomic operations within spinlocks  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hi,

On 2020-06-10 07:26:32 -0400, Robert Haas wrote:
> On Fri, Jun 5, 2020 at 8:19 PM Andres Freund <andres@anarazel.de> wrote:
> > Randomly noticed while looking at the code:
> >         uint64          flagbit = UINT64CONST(1) << (uint64) type;
> >
> > that shouldn't be 64bit, right?
> 
> I'm going to admit ignorance here. What's the proper coding rule?

Well, pss_barrierCheckMask member is just 32bit, so it seems odd to
declare the local variable 64bit?

    uint64        flagbit = UINT64CONST(1) << (uint64) type;
...
        pg_atomic_fetch_or_u32(&slot->pss_barrierCheckMask, flagbit);


Greetings,

Andres Freund



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

Предыдущее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: pg_upgrade fails with non-standard ACL
Следующее
От: Andres Freund
Дата:
Сообщение: Re: global barrier & atomics in signal handlers (Re: Atomicoperations within spinlocks)