Re: unconstify equivalent for volatile

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: unconstify equivalent for volatile
Дата
Msg-id d3be3509-9248-4afe-d6de-4ed83a7553de@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: unconstify equivalent for volatile  (Andres Freund <andres@anarazel.de>)
Ответы Re: unconstify equivalent for volatile  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 2019-02-18 21:25, Andres Freund wrote:
> ISTM this one should rather be solved by removing all volatiles from
> latch.[ch]. As that's a cross-process concern we can't rely on it
> anyway (and have placed barriers a few years back to allay concerns /
> bugs due to reordering).

Aren't the volatiles there so that Latch variables can be set from
signal handlers?

>> diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c
>> index d707993bf6..48f4311464 100644
>> --- a/src/backend/storage/ipc/pmsignal.c
>> +++ b/src/backend/storage/ipc/pmsignal.c
>> @@ -134,7 +134,7 @@ PMSignalShmemInit(void)
>>  
>>      if (!found)
>>      {
>> -        MemSet(PMSignalState, 0, PMSignalShmemSize());
>> +        MemSet(unvolatize(PMSignalData *, PMSignalState), 0, PMSignalShmemSize());
>>          PMSignalState->num_child_flags = MaxLivePostmasterChildren();
>>      }
>>  }
> 
> Same.  Did you put an type assertion into MemSet(), or how did you
> discover this one as needing to be changed?

Build with -Wcast-qual, which warns for this because MemSet() does a
(void *) cast.

> .oO(We really ought to remove MemSet()).

yeah

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" testpending solution of its timing is (fwd)
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: CPU costs of random_zipfian in pgbench