On 2020-Mar-27, Kyotaro Horiguchi wrote:
> +/*
> + * XLogArchiveWakeupEnd - Set up archiver wakeup stuff
> + */
> +void
> +XLogArchiveWakeupStart(void)
> +{
> + Latch *old_latch PG_USED_FOR_ASSERTS_ONLY;
> +
> + SpinLockAcquire(&XLogCtl->info_lck);
> + old_latch = XLogCtl->archiverWakeupLatch;
> + XLogCtl->archiverWakeupLatch = MyLatch;
> + SpinLockRelease(&XLogCtl->info_lck);
> + Assert (old_latch == NULL);
> +}
Comment is wrong about the function name; OTOH I don't think the
old_latch assigment in the fourth line won't work well in non-assert
builds. But why do you need those shenanigans? Surely
"Assert(XLogCtl->archiverWakeupLatch == NULL)" in the locked region
before assigning MyLatch should be sufficient and acceptable?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services