diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 23563723ae29..5a5a96f3ce55 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -610,7 +610,9 @@ kse_create(struct thread *td, struct kse_create_args *uap) ncpus = virtual_cpu; /* Easier to just set it than to test and set */ + PROC_LOCK(p); p->p_flag |= P_THREADED; + PROC_UNLOCK(p); kg = td->td_ksegrp; if (uap->newgroup) { /* Have race condition but it is cheap */ diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 23563723ae29..5a5a96f3ce55 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -610,7 +610,9 @@ kse_create(struct thread *td, struct kse_create_args *uap) ncpus = virtual_cpu; /* Easier to just set it than to test and set */ + PROC_LOCK(p); p->p_flag |= P_THREADED; + PROC_UNLOCK(p); kg = td->td_ksegrp; if (uap->newgroup) { /* Have race condition but it is cheap */