SIGSTOP/SIGCONT is not working with any getchar or read ...
1) Compile and start a prog
2) Press enter to print 'Hello'
3) send kill -19 <pid> // SIGSTOP
4) send kill -18 <pid> // SIGCONT
Prob: it will not resume, (I don't want to use 'fg')
Pleas help.
/* START */
#include<stdio.h>
#include<stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
void my_handle(int sig) {
printf("Do Nothing\n");
}
int main() {
printf("my pid = %d\n", getpid());
signal(SIGCONT, my_handle);
while(1) {
printf("Hello\n");
getchar();
//sleep(1);
}
return 0;
}
/* END */
|