45#ifndef XTC_LWLOCK_MAX_BACKENDS
46#define XTC_LWLOCK_MAX_BACKENDS 4096
49typedef enum xtc_lwlock_mode {
55typedef struct xtc_lwlock {
56 _Atomic uint32_t state;
57 pthread_mutex_t wait_mu;
58 pthread_cond_t wait_cv;
90int xtc_lwlock_init(
xtc_lwlock_t *lock, uint16_t tranche);
94int xtc_lwlock_acquire(
xtc_lwlock_t *lock, xtc_lwlock_mode_t mode);
98int xtc_lwlock_acquire_cond(
xtc_lwlock_t *lock, xtc_lwlock_mode_t mode);
106int xtc_lwlock_held_by_me_in_mode(
const xtc_lwlock_t *lock,
107 xtc_lwlock_mode_t mode);
119typedef void (*xtc_lwlock_track_fn)(uint16_t held_tranche,
120 uint16_t acquired_tranche,
void *user);
121void xtc_lwlock_track_enable(
int on);
122long xtc_lwlock_track_violations(
void);
123void xtc_lwlock_track_reset(
void);
124void xtc_lwlock_track_set_handler(xtc_lwlock_track_fn fn,
void *user);