0

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04 says:

The default action for SIGCONT is to resume execution at the point where the process was stopped, after first handling any pending unblocked signals.

What does "after" mean here? Shouldn't it be "before" instead? Is there some example to show what it means?

Similarly from APUE:

Since the process group is orphaned when the parentterminates, POSIX.1 requires that every process in the newly orphaned process group that is stopped (as our child is) be sent the hang-up signal (SIGHUP) followed by the continue signal (SIGCONT)

This causes the child to be continued, after processing the hang-up signal. The default action for the hang-up signal is to terminate the process, so we have to provide a signal handler to catch the signal. We therefore expect the printf in the sig_hup function to appear before the printf in the pr_ids function.

Shouldn't "after" be "before" instead?

https://stackoverflow.com/a/17769300/156458 seems to suggest "before" instead of "after" in the above two quotes, or I misunderstand it:

The SIGHUP cannot be delivered until the child's execution is resumed. When a process is stopped, all signal delivery is suspended except for SIGCONT and SIGKILL.

So, the SIGHUP does arrive first, but it cannot be processed until the SIGCONT awakens the process execution.

Thanks.

https://stackoverflow.com/questions/50635458/when-several-signals-arrive-at-a-process-what-is-the-order-between-the-process#comment94663185_50671773

2

No, it means after. The key is "resume execution at the point where the process was stopped".

Signal processing is performed first, and then execution continues.

2

https://github.com/torvalds/linux/blob/master/kernel/signal.c POSIX 1b compliant signal kernel code

Do a search on SIGCONT. You will see that when SIGCONT is encountered the code then looks for pending signals.

  • Thanks. Could you point out which line in the source file is for "when SIGCONT is encountered the code then looks for pending signals"? – Tim Dec 24 '18 at 21:10
  • Try the comments found on lines 661, 862, 2028. Reading the code is time consuming , so consider starting with comments. If you search on "SIGCONT" you will find all of the comments and some of the relevant lines of code. – jim mcnamara Dec 25 '18 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.