On August 19, 2016 2:50:30 AM PDT, Aleksander Alekseev
>Heikki, Peter, thanks a lot for code review!
>> What's going on here? Surely pg_atomic_init_u64() should initialize
>> the value?
>It's because of how pg_atomic_exchange_u64_impl is implemented:
> old = ptr->value; /* <-- reading of uninitialized value! */
> if (pg_atomic_compare_exchange_u64_impl(ptr, &old, xchg_))
>Currently pg_atomic_init_u64 works like this:
> `- pg_atomic_write_u64_impl
> `- pg_atomic_exchange_u64_impl
>I suspect there is actually no need to make an atomic exchange during
>initialization of an atomic variable. Regular `mov` should be enough
>(IIRC there is no need to do `lock mov` since `mov` is already atomic).
>Anyway I don't feel brave enough right now to mess with atomic
>operations since it involves all sort of portability issues. So I
>removed this change for now.
There's platforms with atomic 8 byte compare exchange, without atomic 8 byte
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: