Lines Matching refs:sem_count_ptr

98 static inline unsigned int SEM_GET_SHARED(atomic_uint* sem_count_ptr) {  in SEM_GET_SHARED()  argument
100 return (atomic_load_explicit(sem_count_ptr, memory_order_relaxed) & SEMCOUNT_SHARED_MASK); in SEM_GET_SHARED()
115 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in sem_init() local
116 atomic_init(sem_count_ptr, count); in sem_init()
143 static int __sem_dec(atomic_uint* sem_count_ptr) { in __sem_dec() argument
144 unsigned int old_value = atomic_load_explicit(sem_count_ptr, memory_order_relaxed); in __sem_dec()
155 } while (!atomic_compare_exchange_weak(sem_count_ptr, &old_value, in __sem_dec()
163 static int __sem_trydec(atomic_uint* sem_count_ptr) { in __sem_trydec() argument
164 unsigned int old_value = atomic_load_explicit(sem_count_ptr, memory_order_relaxed); in __sem_trydec()
175 } while (!atomic_compare_exchange_weak(sem_count_ptr, &old_value, in __sem_trydec()
187 static int __sem_inc(atomic_uint* sem_count_ptr) { in __sem_inc() argument
188 unsigned int old_value = atomic_load_explicit(sem_count_ptr, memory_order_relaxed); in __sem_inc()
208 } while (!atomic_compare_exchange_weak(sem_count_ptr, &old_value, in __sem_inc()
215 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in sem_wait() local
216 unsigned int shared = SEM_GET_SHARED(sem_count_ptr); in sem_wait()
219 if (__sem_dec(sem_count_ptr) > 0) { in sem_wait()
223 … int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr); in sem_wait()
234 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in __sem_timedwait() local
239 if (__sem_trydec(sem_count_ptr) > 0) { in __sem_timedwait()
250 unsigned int shared = SEM_GET_SHARED(sem_count_ptr); in __sem_timedwait()
254 if (__sem_dec(sem_count_ptr) > 0) { in __sem_timedwait()
259 int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, in __sem_timedwait()
290 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in sem_post() local
291 unsigned int shared = SEM_GET_SHARED(sem_count_ptr); in sem_post()
293 int old_value = __sem_inc(sem_count_ptr); in sem_post()
296 __futex_wake_ex(sem_count_ptr, shared, INT_MAX); in sem_post()
307 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in sem_trywait() local
308 if (__sem_trydec(sem_count_ptr) > 0) { in sem_trywait()
317 atomic_uint* sem_count_ptr = SEM_TO_ATOMIC_POINTER(sem); in sem_getvalue() local
322 int val = SEMCOUNT_TO_VALUE(atomic_load(sem_count_ptr)); in sem_getvalue()