Lines Matching defs:fw

375 	struct futex_wait *fw, *fw_next;
383 TAILQ_FOREACH_SAFE(fw, &f->fx_queue, fw_entry, fw_next) {
384 mutex_enter(&fw->fw_lock);
385 futex_wait_dequeue(fw, f);
386 cv_broadcast(&fw->fw_cv);
387 mutex_exit(&fw->fw_lock);
780 * futex_wait_init(fw, bitset)
788 futex_wait_init(struct futex_wait *fw, int bitset)
793 mutex_init(&fw->fw_lock, MUTEX_DEFAULT, IPL_NONE);
794 cv_init(&fw->fw_cv, "futex");
795 fw->fw_futex = NULL;
796 fw->fw_bitset = bitset;
797 fw->fw_aborting = false;
801 * futex_wait_fini(fw)
807 futex_wait_fini(struct futex_wait *fw)
810 KASSERT(fw->fw_futex == NULL);
812 cv_destroy(&fw->fw_cv);
813 mutex_destroy(&fw->fw_lock);
817 * futex_wait_enqueue(fw, f)
819 * Put fw on the futex queue. Must be done before futex_wait.
820 * Caller must hold fw's lock and f's lock, and fw must not be on
824 futex_wait_enqueue(struct futex_wait *fw, struct futex *f)
828 KASSERT(mutex_owned(&fw->fw_lock));
829 KASSERT(fw->fw_futex == NULL);
830 KASSERT(!fw->fw_aborting);
832 fw->fw_futex = f;
833 TAILQ_INSERT_TAIL(&f->fx_queue, fw, fw_entry);
837 * futex_wait_dequeue(fw, f)
839 * Remove fw from the futex queue. Precludes subsequent
840 * futex_wait until a futex_wait_enqueue. Caller must hold fw's
841 * lock and f's lock, and fw must be on f.
844 futex_wait_dequeue(struct futex_wait *fw, struct futex *f)
848 KASSERT(mutex_owned(&fw->fw_lock));
849 KASSERT(fw->fw_futex == f);
851 TAILQ_REMOVE(&f->fx_queue, fw, fw_entry);
852 fw->fw_futex = NULL;
856 * futex_wait_abort(fw)
858 * Caller is no longer waiting for fw. Remove it from any queue
859 * if it was on one. Caller must hold fw->fw_lock.
862 futex_wait_abort(struct futex_wait *fw)
866 KASSERT(mutex_owned(&fw->fw_lock));
873 f = fw->fw_futex;
877 LIST_INSERT_HEAD(&f->fx_abortlist, fw, fw_abort);
881 * Mark fw as aborting so it won't lose wakeups and won't be
884 fw->fw_aborting = true;
887 mutex_exit(&fw->fw_lock);
889 /* Now we can remove fw under the queue lock. */
891 mutex_enter(&fw->fw_lock);
892 futex_wait_dequeue(fw, f);
893 mutex_exit(&fw->fw_lock);
901 LIST_REMOVE(fw, fw_abort);
913 * Reacquire the fw lock as caller expects. Verify that we're
916 mutex_enter(&fw->fw_lock);
917 KASSERT(fw->fw_aborting);
918 KASSERT(fw->fw_futex == NULL);
922 * futex_wait(fw, deadline, clkid)
924 * fw must be a waiter on a futex's queue. Wait until deadline on
927 * ETIMEDOUT on timeout, EINTR/ERESTART on signal. Either way, fw
931 futex_wait(struct futex_wait *fw, const struct timespec *deadline,
937 mutex_enter(&fw->fw_lock);
941 if (fw->fw_bitset == 0 || fw->fw_futex == NULL) {
969 error = cv_timedwait_sig(&fw->fw_cv, &fw->fw_lock,
973 error = cv_wait_sig(&fw->fw_cv, &fw->fw_lock);
978 * If we were woken up, the waker will have removed fw from the
979 * queue. But if anything went wrong, we must remove fw from
984 futex_wait_abort(fw);
989 mutex_exit(&fw->fw_lock);
1006 struct futex_wait *fw, *fw_next;
1014 TAILQ_FOREACH_SAFE(fw, &f->fx_queue, fw_entry, fw_next) {
1015 if ((fw->fw_bitset & bitset) == 0)
1018 mutex_enter(&fw->fw_lock);
1019 if (__predict_false(fw->fw_aborting)) {
1020 mutex_exit(&fw->fw_lock);
1023 futex_wait_dequeue(fw, f);
1024 fw->fw_bitset = 0;
1025 cv_broadcast(&fw->fw_cv);
1026 mutex_exit(&fw->fw_lock);
1043 TAILQ_FOREACH_SAFE(fw, &f->fx_queue, fw_entry, fw_next) {
1044 if ((fw->fw_bitset & bitset) == 0)
1047 mutex_enter(&fw->fw_lock);
1048 if (__predict_false(fw->fw_aborting)) {
1049 mutex_exit(&fw->fw_lock);
1052 futex_wait_dequeue(fw, f);
1053 futex_wait_enqueue(fw, f2);
1054 mutex_exit(&fw->fw_lock);
1208 struct futex_wait wait, *fw = &wait;
1242 futex_wait_init(fw, val3);
1257 mutex_enter(&fw->fw_lock);
1258 futex_wait_enqueue(fw, f);
1259 mutex_exit(&fw->fw_lock);
1271 error = futex_wait(fw, deadline, clkid);
1280 futex_wait_fini(fw);