I know that SIGCONT continues a process previously stopped by SIGSTOP. Can I use SIGCONT multiple times without a SIGSTOP ? i,e , below sequence is valid ?
SIGSTOP to process A : The process stops
SIGCONT to process A : Process resumes
SIGCONT to process A : Process already runs - this SIGCONT has no effect
SIGCONT to process A : Process already runs - this SIGCONT has no effect
...
SIGSTOP to process A : The process stops
SIGCONT to process A : Process resumes
Regardless of user ID, a process can always send a SIGCONT signal to a process that is a member of the same session (same session ID) as the sender. You can use either signal() or sigaction() to specify how a signal will be handled when kill() is invoked. A process can use kill() to send a signal to itself.
You can use a handler for SIGCONT to make a program do something special when it is stopped and continued—for example, to reprint a prompt when it is suspended while waiting for input. The SIGSTOP signal stops the process. It cannot be handled, ignored, or blocked.
SIGTHSTOP and SIGTHCONT cannot be caught or ignored; they always take effect.
In short, SIGSTOP tells a process to “hold on” and SIGCONT tells a process to “pick up where you left off”. This can work really well for rsync jobs since you can pause the job, clear up some space on the destination device, and then resume the job.
You can do it. TLPI says:
When sent to a stopped process, this signal causes the process to resume (i.e., to be rescheduled to run at some later time). When received by a process that is not currently stopped, this signal is ignored by default. A process may catch this signal, so that it carries out some action when it resumes.
APUE:
Note that the default action for SIGCONT is to continue the process, if it is stopped; otherwise, the signal is ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With