diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-04-03 11:57:51 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-04-03 11:57:51 +0000 |
commit | f9d3fda14f0fe7c403bd68483565472e6e975f5f (patch) | |
tree | 0a79e06c090fc2bdbcba1ab48915a947e6a0300c /sys/kern | |
parent | 1dcab46e6dea89c4b63b4889172e81c9c9b2ca03 (diff) |
Reduce indent in single_thread_check_locked() by inverting initial
if () check which just returns.
OK mpi@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sig.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 54c86f6dcf4..52e8571663b 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.305 2023/02/10 14:34:17 visa Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.306 2023/04/03 11:57:50 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -2018,31 +2018,32 @@ single_thread_check_locked(struct proc *p, int deep, int s) SCHED_ASSERT_LOCKED(); - if (pr->ps_single != NULL && pr->ps_single != p) { - do { - /* if we're in deep, we need to unwind to the edge */ - if (deep) { - if (pr->ps_flags & PS_SINGLEUNWIND) - return (ERESTART); - if (pr->ps_flags & PS_SINGLEEXIT) - return (EINTR); - } + if (pr->ps_single == NULL || pr->ps_single == p) + return (0); - if (atomic_dec_int_nv(&pr->ps_singlecount) == 0) - wakeup(&pr->ps_singlecount); + do { + /* if we're in deep, we need to unwind to the edge */ + if (deep) { + if (pr->ps_flags & PS_SINGLEUNWIND) + return (ERESTART); + if (pr->ps_flags & PS_SINGLEEXIT) + return (EINTR); + } - if (pr->ps_flags & PS_SINGLEEXIT) { - SCHED_UNLOCK(s); - KERNEL_LOCK(); - exit1(p, 0, 0, EXIT_THREAD_NOCHECK); - /* NOTREACHED */ - } + if (atomic_dec_int_nv(&pr->ps_singlecount) == 0) + wakeup(&pr->ps_singlecount); - /* not exiting and don't need to unwind, so suspend */ - p->p_stat = SSTOP; - mi_switch(); - } while (pr->ps_single != NULL); - } + if (pr->ps_flags & PS_SINGLEEXIT) { + SCHED_UNLOCK(s); + KERNEL_LOCK(); + exit1(p, 0, 0, EXIT_THREAD_NOCHECK); + /* NOTREACHED */ + } + + /* not exiting and don't need to unwind, so suspend */ + p->p_stat = SSTOP; + mi_switch(); + } while (pr->ps_single != NULL); return (0); } |