diff options
author | 2020-03-20 08:14:07 +0000 | |
---|---|---|
committer | 2020-03-20 08:14:07 +0000 | |
commit | 3d15958b50e243f07ddb553a3ba14755c96ef8f5 (patch) | |
tree | 0ceade24a7f58f02bc32287d0e70bcc2db87df25 /sys/kern/kern_fork.c | |
parent | Reshuffle code more to separate out the output functions into output.c. (diff) | |
download | wireguard-openbsd-3d15958b50e243f07ddb553a3ba14755c96ef8f5.tar.xz wireguard-openbsd-3d15958b50e243f07ddb553a3ba14755c96ef8f5.zip |
Use atomic operations to update ps_singlecount. This makes
single_thread_check() safe to be called without KERNEL_LOCK().
single_thread_wait() needs to use sleep_setup() and sleep_finish()
instead of tsleep() to make sure no wakeup() is lost.
Input kettenis@, with and OK visa@
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 71129dd4079..6cfb39b6252 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.224 2020/03/16 11:58:46 mpi Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.225 2020/03/20 08:14:07 claudio Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -563,7 +563,7 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, * count ourselves in. */ if (pr->ps_single) { - pr->ps_singlecount++; + atomic_inc_int(&pr->ps_singlecount); atomic_setbits_int(&p->p_flag, P_SUSPSINGLE); } |