• Marko Mäkelä's avatar
    MDEV-24142 preparation: Add srw_mutex and srw_lock::u_lock() · d46b4248
    Marko Mäkelä authored
    The PERFORMANCE_SCHEMA insists on distinguishing read-update-write
    locks from read-write locks, so we must add
    template<bool support_u_lock> in rd_lock() and wr_lock() operations.
    
    rd_lock::read_trylock(): Add template<bool prioritize_updater=false>
    which is used by the srw_lock_low::read_lock() loop. As long as
    an UPDATE lock has already been granted to some thread, we will grant
    subsequent READ lock requests even if a waiting WRITE lock request
    exists. This will be necessary to be compatible with existing usage
    pattern of InnoDB rw_lock_t where the holder of SX-latch (which we
    will rename to UPDATE latch) may acquire an additional S-latch
    on the same object. For normal read-write locks without update operations
    this should make no difference at all, because the rw_lock::UPDATER
    flag would never be set.
    d46b4248
rw_lock.h 6.63 KB