Lines Matching refs:state

119   rwlock->state = 0;
128 if (rwlock->state != 0) {
146 int32_t cur_state = rwlock->state; // C++11 relaxed atomic read
149 done = __sync_bool_compare_and_swap(&rwlock->state, cur_state, cur_state + 1); // C++11 memory_order_aquire
155 // To avoid losing wake ups the pending_readers update and the state read should be
158 int ret = __futex_wait_ex(&rwlock->state, rwlock_is_shared(rwlock), cur_state, rel_timeout);
179 int32_t cur_state = rwlock->state;
181 // Change state from 0 to -1.
182 done = __sync_bool_compare_and_swap(&rwlock->state, 0 /* cur state */, -1 /* new state */); // C++11 memory_order_aquire
188 // To avoid losing wake ups the pending_writers update and the state read should be
191 int ret = __futex_wait_ex(&rwlock->state, rwlock_is_shared(rwlock), cur_state, rel_timeout);
212 int32_t cur_state = rwlock->state;
214 __sync_bool_compare_and_swap(&rwlock->state, cur_state, cur_state + 1)) { // C++11 memory_order_acquire
230 int32_t cur_state = rwlock->state;
232 __sync_bool_compare_and_swap(&rwlock->state, 0 /* cur state */, -1 /* new state */)) { // C++11 memory_order_acquire
244 int32_t cur_state = rwlock->state;
254 // Change state from -1 to 0.
255 // We use __sync_bool_compare_and_swap to achieve sequential consistency of the state store and
259 __sync_bool_compare_and_swap( &rwlock->state, -1 /* cur state*/, 0 /* new state */); // C++11 maybe memory_order_seq_cst?
263 __futex_wake_ex(&rwlock->state, rwlock_is_shared(rwlock), INT_MAX);
267 // Reduce state by 1.
269 done = __sync_bool_compare_and_swap(&rwlock->state, cur_state, cur_state - 1); // C++11 maybe memory_order_seq_cst?
273 __futex_wake_ex(&rwlock->state, rwlock_is_shared(rwlock), INT_MAX);