On Wed, Oct 30, 2019 at 05:21:17PM +0900, Fujii Masao wrote:
> This change causes every ending backends to always take the exclusive lock
> even when it's not in SyncRep queue. This may be problematic, for example,
> when terminating multiple backends at the same time? If yes,
> it might be better to check SHMQueueIsDetached() again after taking the lock.
> That is,
>
> if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
> {
> LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
> if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
> SHMQueueDelete(&(MyProc->syncRepLinks));
> LWLockRelease(SyncRepLock);
> }
Makes sense. Thanks for the suggestion.
--
Michael