Re: [PATCH 09/11] job control: reorganize wait_task_stopped()

From: Oleg Nesterov
Date: Thu May 12 2011 - 14:34:55 EST


On 05/12, Tejun Heo wrote:
>
> int main(int argc, char **argv)
> {
> pid_t child, control;
>
> child = fork();
> if (!child)
> while (1)
> pause();
>
> kill(child, SIGSTOP);
> waitid(P_PID, child, NULL, WSTOPPED | WNOWAIT);
>
> control = fork();
> if (!control) {
> while (1) {
> kill(child, SIGCONT);
> nanosleep(&ts1ms, NULL);
> kill(child, SIGSTOP);
> nanosleep(&ts1ms, NULL);

Damn, you are right, I think.

At first glance, do_wait() does

wait_task_stopped();
wait_task_continued();

and the state can be changed CONTINIUED -> STOPPED in between, right?
Or something else?

Thanks, for the explanation.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/