• Heikki Linnakangas's avatar
    When building with LWLOCK_STATS, initialize the stats in LWLockWaitUntilFree. · 15ad6f15
    Heikki Linnakangas authored
    If LWLockWaitUntilFree was called before the first LWLockAcquire call, you
    would either crash because of access to uninitialized array or account the
    acquisition incorrectly. LWLockConditionalAcquire doesn't have this problem
    because it doesn't update the lwlock stats.
    
    In practice, this never happens because there is no codepath where you would
    call LWLockWaitUntilfree before LWLockAcquire after a new process is
    launched. But that's just accidental, there's no guarantee that that's
    always going to be true in the future.
    
    Spotted by Jeff Janes.
    15ad6f15
lwlock.c 22.8 KB