Protect ps_single, ps_singlecnt and ps_threadcnt by the process mutex.
authorclaudio <claudio@openbsd.org>
Mon, 4 Sep 2023 13:18:41 +0000 (13:18 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 4 Sep 2023 13:18:41 +0000 (13:18 +0000)
commit4260963390db52f81c998a36b1c71b872da4968f
treeec89f9dd36bfaef017f323d6b04e653021395561
parentc02a7420f1ec019a74b86d63369c4755aa293a2d
Protect ps_single, ps_singlecnt and ps_threadcnt by the process mutex.

The single thread API needs to lock the process to enter single thread
mode and does not need to stop the scheduler.

This code changes ps_singlecount from a count down to zero to ps_singlecnt
which counts up until equal to ps_threadcnt (in which case all threads
are properly asleep).

Tested by phessler@, OK mpi@ cheloha@
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_sig.c
sys/sys/proc.h