From: claudio Date: Mon, 3 Apr 2023 11:57:50 +0000 (+0000) Subject: Reduce indent in single_thread_check_locked() by inverting initial X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd5b0d5c6fe6421d413a8ea362e1ddb77b5c7460;p=openbsd Reduce indent in single_thread_check_locked() by inverting initial if () check which just returns. OK mpi@ --- 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); }