Open System Services Programmer's Guide
}
void sig_cld1(int signo)
{
printf("\nSignal received for Thread1 is %d\n",signo);
}
void sig_cld2(int signo)
{
printf("\nSignal received for Thread2 is %d\n",signo);
}
Example 66 (page 326) provides an example of SIGALRM handling. It creates two threads that
wait for a SIGALRM signal.
The output of Example 66 (page 326) depends on whether thread-aware signal handling is enabled:
• If thread-aware signal handling not enabled, the entire process terminates when the SIGALRM
signal is received. Sample output:
spt_sigaction for thread1 returned 0
spt_sigaction for thread2 returned 0
• If thread- aware signal handling is enabled, SIGALRM signal is delivered to the correct thread,
and the sighand1() and sighand2() functions define the actions to be taken . Sample output:
spt_sigaction for thread1 returned 0
spt_sigaction for thread2 returned 0
Signal received for thread1 is 14
spt_sigsuspend for thread1 returned -1
spt_sigwait returned 0
spt_sigwait for thread2 returned for signal 14
Main Completed
Standard POSIX Threads 325