Lines Matching refs:rw
49 ck_swlock_init(struct ck_swlock *rw) in ck_swlock_init() argument
52 rw->value = 0; in ck_swlock_init()
58 ck_swlock_write_unlock(ck_swlock_t *rw) in ck_swlock_write_unlock() argument
62 ck_pr_and_32(&rw->value, CK_SWLOCK_READER_MASK); in ck_swlock_write_unlock()
67 ck_swlock_locked_writer(ck_swlock_t *rw) in ck_swlock_locked_writer() argument
71 r = ck_pr_load_32(&rw->value) & CK_SWLOCK_WRITER_BIT; in ck_swlock_locked_writer()
77 ck_swlock_write_downgrade(ck_swlock_t *rw) in ck_swlock_write_downgrade() argument
80 ck_pr_inc_32(&rw->value); in ck_swlock_write_downgrade()
81 ck_swlock_write_unlock(rw); in ck_swlock_write_downgrade()
86 ck_swlock_locked(ck_swlock_t *rw) in ck_swlock_locked() argument
90 r = ck_pr_load_32(&rw->value); in ck_swlock_locked()
96 ck_swlock_write_trylock(ck_swlock_t *rw) in ck_swlock_write_trylock() argument
100 r = ck_pr_cas_32(&rw->value, 0, CK_SWLOCK_WRITER_BIT); in ck_swlock_write_trylock()
109 ck_swlock_write_lock(ck_swlock_t *rw) in CK_ELIDE_TRYLOCK_PROTOTYPE()
112 ck_pr_or_32(&rw->value, CK_SWLOCK_WRITER_BIT); in CK_ELIDE_TRYLOCK_PROTOTYPE()
113 while (ck_pr_load_32(&rw->value) & CK_SWLOCK_READER_MASK) in CK_ELIDE_TRYLOCK_PROTOTYPE()
121 ck_swlock_write_latch(ck_swlock_t *rw) in ck_swlock_write_latch() argument
125 ck_pr_or_32(&rw->value, CK_SWLOCK_WRITER_BIT); in ck_swlock_write_latch()
128 while (ck_pr_cas_32(&rw->value, CK_SWLOCK_WRITER_BIT, in ck_swlock_write_latch()
132 } while (ck_pr_load_32(&rw->value) != CK_SWLOCK_WRITER_BIT); in ck_swlock_write_latch()
140 ck_swlock_write_unlatch(ck_swlock_t *rw) in ck_swlock_write_unlatch() argument
144 ck_pr_store_32(&rw->value, 0); in ck_swlock_write_unlatch()
156 ck_swlock_read_trylock(ck_swlock_t *rw) in CK_ELIDE_PROTOTYPE()
158 uint32_t l = ck_pr_load_32(&rw->value); in CK_ELIDE_PROTOTYPE()
163 l = ck_pr_faa_32(&rw->value, 1) & CK_SWLOCK_WRITER_MASK; in CK_ELIDE_PROTOTYPE()
165 ck_pr_dec_32(&rw->value); in CK_ELIDE_PROTOTYPE()
172 ck_swlock_read_lock(ck_swlock_t *rw) in ck_swlock_read_lock() argument
177 while (ck_pr_load_32(&rw->value) & CK_SWLOCK_WRITER_BIT) in ck_swlock_read_lock()
180 l = ck_pr_faa_32(&rw->value, 1) & CK_SWLOCK_WRITER_MASK; in ck_swlock_read_lock()
190 ck_pr_dec_32(&rw->value); in ck_swlock_read_lock()
198 ck_swlock_locked_reader(ck_swlock_t *rw) in ck_swlock_locked_reader() argument
202 return ck_pr_load_32(&rw->value) & CK_SWLOCK_READER_MASK; in ck_swlock_locked_reader()
206 ck_swlock_read_unlock(ck_swlock_t *rw) in ck_swlock_read_unlock() argument
210 ck_pr_dec_32(&rw->value); in ck_swlock_read_unlock()