Open System Services Programmer's Guide
Example 65 (page 324) demonstrates handling the SIGCHLD signal. This example creates two
threads, each of which call fork(). When the child process executes, the process raises the
SIGCHLD signal.
The output of Example 65 (page 324) depends on whether thread-aware signal handling is enabled:
• If thread-aware signal handling is not enabled, the SIGCHLD signal results in the default action
described in Table 56 (page 316) (discard the signal). In this example, spt_sigaction()
fails because it is not supported. Sample output:
spt_sigaction for thread1 returned -1
spt_sigaction for thread2 returned -1
Inside Child of Thread1
Inside Child of Thread2
Main Completed
• If thread-aware signal handling is enabled, the SIGCHLD signal is delivered to the correct
thread, and spt_sigaction() function in the example defines the action to be taken.
Sample output:
spt_sigaction for thread1 returned 0
spt_sigaction for thread2 returned 0
Inside Child of Thread2
Signal received for Thread2 is 18
Inside Child of Thread1
Signal received for Thread1 is 18
Main Completed
Standard POSIX Threads 323