summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 5d3ee5312c6..378b367efe5 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.148 2013/06/03 16:55:22 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.149 2013/06/03 22:35:15 guenther Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -323,16 +323,7 @@ fork1(struct proc *curp, int exitsig, int flags, void *stack, pid_t *tidptr,
if (flags & FORK_THREAD) {
atomic_setbits_int(&p->p_flag, P_THREAD);
p->p_p = pr = curpr;
- TAILQ_INSERT_TAIL(&pr->ps_threads, p, p_thr_link);
pr->ps_refcnt++;
- /*
- * if somebody else wants to take us to single threaded mode,
- * count ourselves in.
- */
- if (pr->ps_single) {
- curpr->ps_singlecount++;
- atomic_setbits_int(&p->p_flag, P_SUSPSINGLE);
- }
} else {
process_new(p, curpr);
pr = p->p_p;
@@ -474,6 +465,16 @@ fork1(struct proc *curp, int exitsig, int flags, void *stack, pid_t *tidptr,
pr->ps_ptstat->pe_other_pid = curpr->ps_pid;
}
}
+ } else {
+ TAILQ_INSERT_TAIL(&pr->ps_threads, p, p_thr_link);
+ /*
+ * if somebody else wants to take us to single threaded mode,
+ * count ourselves in.
+ */
+ if (pr->ps_single) {
+ curpr->ps_singlecount++;
+ atomic_setbits_int(&p->p_flag, P_SUSPSINGLE);
+ }
}
#if NSYSTRACE > 0