Problem with pg_atomic_compare_exchange_u64 at 32-bit platformwd
В списке pgsql-hackers по дате отправления:
| От | Konstantin Knizhnik |
|---|---|
| Тема | Problem with pg_atomic_compare_exchange_u64 at 32-bit platformwd |
| Дата | |
| Msg-id | 79caaa1f-0290-652f-d203-35d2709e7478@postgrespro.ru обсуждение |
| Ответы |
Re: Problem with pg_atomic_compare_exchange_u64 at 32-bit platformwd
|
| Список | pgsql-hackers |
Definition of pg_atomic_compare_exchange_u64 requires alignment of
expected pointer on 8-byte boundary.
pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
uint64 *expected, uint64 newval)
{
#ifndef PG_HAVE_ATOMIC_U64_SIMULATION
AssertPointerAlignment(ptr, 8);
AssertPointerAlignment(expected, 8);
#endif
I wonder if there are platforms where such restriction is actually needed.
And if so, looks like our ./src/test/regress/regress.c is working only
occasionally:
static void
test_atomic_uint64(void)
{
pg_atomic_uint64 var;
uint64 expected;
...
if (!pg_atomic_compare_exchange_u64(&var, &expected, 1))
because there is no warranty that "expected" variable will be aligned on
stack at 8 byte boundary (at least at Win32).
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера