Add SIGSTOP in SIGTSTP to properly stop the process.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 21 Jun 2014 05:58:35 +0000 (07:58 +0200)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 21 Jun 2014 05:58:35 +0000 (07:58 +0200)
src/process1.c
src/process2.c
src/process3.c

index aa27e8cf8857c9466c41e909cd1407a8906edda0..9fdee30b55edb5020a3eb2c05201fa24154f44ca 100644 (file)
@@ -42,6 +42,7 @@ void sig_handler(int signo)
        else if (signo == SIGTSTP) {
                fprintf(stderr, "[%s] > Closing pipe\n", "process1");
                close(write_pipe);
+               raise (SIGSTOP);
        }
        else if (signo == SIGCONT) {
                fprintf(stderr, "[%s] > Opening pipe\n", "process1");
index 87871e78675ecf56fa35ee9a4df9ab2712c667e7..49081737183fa6d1fc98faf725daed73a78d09bc 100644 (file)
@@ -42,6 +42,7 @@ void sig_handler(int signo)
                fprintf(stderr, "[%s] > Closing pipes\n", "process2");
                close(read_descriptor);
                close(write_descriptor);
+               raise (SIGSTOP);
        }
        else if (signo == SIGCONT) {
                fprintf(stderr, "[%s] > Opening pipes\n", "process2");
index b75f903af10e363d5c96d07000fa22609322f025..12efd4090aa71a9d3c51013ffd3acbd7f91d0558 100644 (file)
@@ -31,6 +31,7 @@ void sig_handler(int signo)
        else if (signo == SIGTSTP) {
                fprintf(stderr, "[%s] > Closing pipe\n", "process3");
                close(read_descriptor);
+               raise (SIGSTOP);
        }
        else if (signo == SIGCONT) {
                fprintf(stderr, "[%s] > Opening pipe\n", "process3");