MINOR: threads: add the transitions to/from the seek state
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Oct 2020 14:53:46 +0000 (16:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Oct 2020 14:53:46 +0000 (16:53 +0200)
commit61f799b8da70fdc9fbb345778ae8190a9b16fda7
tree14d1af371d79d82774fa478c94d68901397d2784
parent8d5360ca7f2c0433d0ae8810a4f8849929a2cee8
MINOR: threads: add the transitions to/from the seek state

Since our locks are based on progressive locks, we support the upgradable
seek lock that is compatible with readers and upgradable to a write lock.
The main purpose is to take it while seeking down a tree for modification
while other threads may seek the same tree for an input (e.g. compute the
next event date).

The newly supported operations are:

  HA_RWLOCK_SKLOCK(lbl,l)         pl_take_s(l)      /* N --> S */
  HA_RWLOCK_SKTOWR(lbl,l)         pl_stow(l)        /* S --> W */
  HA_RWLOCK_WRTOSK(lbl,l)         pl_wtos(l)        /* W --> S */
  HA_RWLOCK_SKTORD(lbl,l)         pl_stor(l)        /* S --> R */
  HA_RWLOCK_WRTORD(lbl,l)         pl_wtor(l)        /* W --> R */
  HA_RWLOCK_SKUNLOCK(lbl,l)       pl_drop_s(l)      /* S --> N */
  HA_RWLOCK_TRYSKLOCK(lbl,l)      (!pl_try_s(l))    /* N -?> S */
  HA_RWLOCK_TRYRDTOSK(lbl,l)      (!pl_try_rtos(l)) /* R -?> S */

Existing code paths are left unaffected so this patch doesn't affect
any running code.
include/haproxy/thread.h