Skip to contentSkip to conversation

signals: document CLD_CONTINUED notification mechanics

PATCH In review Oleg Nesterov 2 participants 2 messages Mar 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 signals: document CLD_CONTINUED notification mechanics

A couple of small comments about how CLD_CONTINUED notification works.

kernel/signal.c renamed from kernel/signal.c~2_DOC_NOTIFY +6 -1
@@ -630,6 +630,11 @@ static int prepare_signal(int sig, struc
 			why |= SIGNAL_CLD_STOPPED;
 
 		if (why) {
+			/*
+			 * The first thread which returns from finish_stop()
+			 * will take ->siglock, notice SIGNAL_CLD_MASK, and
+			 * notify its parent. See get_signal_to_deliver().
+			 */
 			signal->flags = why | SIGNAL_STOP_CONTINUED;
 			signal->group_stop_count = 0;
 			signal->group_exit_code = 0;
@@ -1652,7 +1657,7 @@ relock:
 	try_to_freeze();
 
 	spin_lock_irq(&sighand->siglock);
-
+	/* see prepare_signal(SIGCONT) */
 	if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
 		int why = (signal->flags & SIGNAL_STOP_CONTINUED)
 				? CLD_CONTINUED : CLD_STOPPED;
#1 lore raw
Quoted 1 line

A couple of small comments about how CLD_CONTINUED notification works.

A worthy addition. I would make the get_signal_to_deliver comment say a little more. In particular, it's kind of nonobvious that though this happens at the beginning of the function, the importance of its placement is really that it will always be run (via the relock: loop) just after any wake-up from having been in TASK_STOPPED.

Thanks,
Roland