kill after sleep
i couldnt make my program sleep() after using kill(pid,SIGTERM) what can i do ?
The code i'm using:
kill(PID_of_Process_to_be_killed,SIGTERM); sleep(5); --> this is not working sleep(5); --> this is working
the solution for now is:
but why the first sleep after kill return 0 ?
Your sleep() call may be terminating early due to receiving a signal. Check the return value. If it's positive, you might want to sleep() again on that value. From http://www.manpagez.com/man/3/Sleep/:
If the sleep() function returns because the requested time has elapsed, the value returned will be zero. If the sleep() function returns due to the delivery of a signal, the value returned will be the unslept amount (the requested time minus the time actually slept) in seconds