Lines Matching refs:fc
252 futex_condvar_assert(const struct futex_condvar *fc) in futex_condvar_assert() argument
255 KASSERT(fc->fc_waitcount >= futex_queue_count(&fc->fc_waiters), in futex_condvar_assert()
257 futex_lock_assert(fc->fc_lock); in futex_condvar_assert()
265 struct futex_condvar *fc; in futex_condvar_lookup() local
273 LIST_FOREACH(fc, &futex_condvar_list, fc_next) { in futex_condvar_lookup()
274 if (futex_address_match(&fc->fc_address, &fa_condvar)) { in futex_condvar_lookup()
277 futex_condvar_assert(fc); in futex_condvar_lookup()
278 *fcret = fc; in futex_condvar_lookup()
294 struct futex_condvar *fc; in futex_condvar_lookup_or_create() local
308 LIST_FOREACH(fc, &futex_condvar_list, fc_next) { in futex_condvar_lookup_or_create()
309 if (!futex_address_match(&fc->fc_address, &fa_condvar)) in futex_condvar_lookup_or_create()
311 fl = fc->fc_lock; in futex_condvar_lookup_or_create()
323 futex_condvar_assert(fc); in futex_condvar_lookup_or_create()
324 *fcret = fc; in futex_condvar_lookup_or_create()
329 fc = malloc(sizeof(*fc), M_FUTEX, M_WAITOK); in futex_condvar_lookup_or_create()
330 fc->fc_address = fa_condvar; in futex_condvar_lookup_or_create()
331 fc->fc_lock = futex_lock_lookup_locked(&fa_lock); in futex_condvar_lookup_or_create()
332 futex_queue_init(&fc->fc_waiters); in futex_condvar_lookup_or_create()
333 fc->fc_waitcount = 0; in futex_condvar_lookup_or_create()
334 LIST_INSERT_HEAD(&futex_condvar_list, fc, fc_next); in futex_condvar_lookup_or_create()
335 *fcret = fc; in futex_condvar_lookup_or_create()
340 futex_condvar_release(struct futex_condvar *fc) in futex_condvar_release() argument
344 futex_condvar_assert(fc); in futex_condvar_release()
345 fl = fc->fc_lock; in futex_condvar_release()
346 if (fc->fc_waitcount == 0) { in futex_condvar_release()
348 futex_address_free(&fc->fc_address); in futex_condvar_release()
349 LIST_REMOVE(fc, fc_next); in futex_condvar_release()
350 free(fc, M_FUTEX); in futex_condvar_release()
356 futex_condvar_unmanage(struct futex_condvar *fc, in futex_condvar_unmanage() argument
360 if (futex_queue_count(&fc->fc_waiters) != 0) in futex_condvar_unmanage()
983 struct futex_condvar *fc; in cloudabi_futex_condvar_wait() local
990 lock_scope, &fc); in cloudabi_futex_condvar_wait()
993 fl = fc->fc_lock; in cloudabi_futex_condvar_wait()
1002 futex_condvar_release(fc); in cloudabi_futex_condvar_wait()
1009 futex_condvar_unmanage(fc, condvar); in cloudabi_futex_condvar_wait()
1010 futex_condvar_release(fc); in cloudabi_futex_condvar_wait()
1015 ++fc->fc_waitcount; in cloudabi_futex_condvar_wait()
1016 error = futex_queue_sleep(&fc->fc_waiters, fc->fc_lock, &fw, td, in cloudabi_futex_condvar_wait()
1024 futex_condvar_unmanage(fc, condvar); in cloudabi_futex_condvar_wait()
1043 futex_condvar_unmanage(fc, condvar); in cloudabi_futex_condvar_wait()
1046 --fc->fc_waitcount; in cloudabi_futex_condvar_wait()
1047 futex_condvar_release(fc); in cloudabi_futex_condvar_wait()
1099 struct futex_condvar *fc; in cloudabi_sys_condvar_signal() local
1111 error = futex_condvar_lookup(td, uap->condvar, uap->scope, &fc); in cloudabi_sys_condvar_signal()
1116 fl = fc->fc_lock; in cloudabi_sys_condvar_signal()
1136 futex_queue_wake_up_donate(&fc->fc_waiters, nwaiters - 1); in cloudabi_sys_condvar_signal()
1143 futex_queue_requeue(&fc->fc_waiters, &fl->fl_writers, nwaiters); in cloudabi_sys_condvar_signal()
1147 error = futex_condvar_unmanage(fc, uap->condvar); in cloudabi_sys_condvar_signal()
1148 futex_condvar_release(fc); in cloudabi_sys_condvar_signal()