diff options
author | 2021-02-08 08:18:45 +0000 | |
---|---|---|
committer | 2021-02-08 08:18:45 +0000 | |
commit | 436960cf02775967604f33beab159c0cf4ade5a0 (patch) | |
tree | 022a7dc14e584a114cfe643944556b30f771ce14 /sys/kern/kern_rwlock.c | |
parent | route-to rules take ips, not interfaces with optional ips. (diff) | |
download | wireguard-openbsd-436960cf02775967604f33beab159c0cf4ade5a0.tar.xz wireguard-openbsd-436960cf02775967604f33beab159c0cf4ade5a0.zip |
Simplify sleep_setup API to two operations in preparation for splitting
the SCHED_LOCK().
Putting a thread on a sleep queue is reduce to the following:
sleep_setup();
/* check condition or release lock */
sleep_finish();
Previous version ok cheloha@, jmatthew@, ok claudio@
Diffstat (limited to 'sys/kern/kern_rwlock.c')
-rw-r--r-- | sys/kern/kern_rwlock.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index c73b1b17fa1..d79b59748e8 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_rwlock.c,v 1.46 2021/01/11 18:49:38 mpi Exp $ */ +/* $OpenBSD: kern_rwlock.c,v 1.47 2021/02/08 08:18:45 mpi Exp $ */ /* * Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org> @@ -279,15 +279,13 @@ retry: prio = op->wait_prio; if (flags & RW_INTR) prio |= PCATCH; - sleep_setup(&sls, rwl, prio, rwl->rwl_name); - if (flags & RW_INTR) - sleep_setup_signal(&sls); + sleep_setup(&sls, rwl, prio, rwl->rwl_name, 0); do_sleep = !rw_cas(&rwl->rwl_owner, o, set); - sleep_finish(&sls, do_sleep); + error = sleep_finish(&sls, do_sleep); if ((flags & RW_INTR) && - (error = sleep_finish_signal(&sls)) != 0) + (error != 0)) return (error); if (flags & RW_SLEEPFAIL) return (EAGAIN); |