PERFORCE change 56497 for review

David Xu davidxu at FreeBSD.org
Mon Jul 5 04:48:47 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=56497

Change 56497 by davidxu at davidxu_alona on 2004/07/05 11:48:24

	Allow a single thread to be resumed, while others are still suspended.

Affected files ...

.. //depot/projects/davidxu_ksedbg/src/sys/kern/sys_process.c#5 edit

Differences ...

==== //depot/projects/davidxu_ksedbg/src/sys/kern/sys_process.c#5 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sys_process.c,v 1.121 2004/07/02 09:19:22 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sys_process.c,v 1.120 2004/04/01 20:56:44 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -371,6 +371,7 @@
 	int error, write, tmp, num;
 	int proctree_locked = 0;
 	lwpid_t tid = 0, tid2, *buf;
+	pid_t saved_pid = pid;
 
 	curp = td->td_proc;
 
@@ -633,10 +634,23 @@
 			p->p_xstat = data;
 			p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG);
 			mtx_lock_spin(&sched_lock);
-			thread_unsuspend_one(p->p_xthread);
+			if (req == PT_DETACH || saved_pid <= PID_MAX) {
+				if (p->p_xthread) {
+					p->p_xthread->td_flags &= ~TDF_XSIG;
+					p->p_xthread->td_xsig = data;
+					p->p_xthread = NULL;
+				}
+				thread_unsuspend(p);
+			} else {
+				td2->td_flags &= ~TDF_XSIG;
+				td2->td_xsig = data;
+				if (p->p_xthread == td2)
+					p->p_xthread  = NULL;
+				thread_unsuspend_one(td2);
+			}
 			mtx_unlock_spin(&sched_lock);
-			p->p_xthread = NULL;
 		} else if (data) {
+			/* can this happen ? */
 			p->p_xthread = NULL;
 			psignal(p, data);
 		}


More information about the p4-projects mailing list