Open System Services Programmer's Guide
Example 64 (page 322) creates a thread that waits for asynchronous signal SIGINT.
Sample input:
> kill -2 process-name
or
<CRTL-C>
Both of these inputs generate a SIGINT signal.
The output of Example 64 (page 322) depends on whether thread-aware signal handling is enabled:
• If thread-aware signal handling is not enabled, the program terminates, which is the default
behavior when signal 2 (SIGINT) is received. Sample output:
Enter Testcase - ./Test2
spt_sigaction returned 0
Wait for threads to complete
• If thread-aware signal handling is enabled, the signal handler of thread1 is executed and
thread1 no longer waits for a signal. Sample output:
Enter Testcase - ./Test2
spt_sigaction returned 0
Wait for threads to complete
Signal received is 2
spt_sigsuspend returned -1
Main completed.
This behavior differs from the behavior when thread-aware signal handling is not enabled
because the generic handler catches the signal delivered to a process and delivers the signal
to the correct thread(s).
Standard POSIX Threads 321