Open System Services Programmer's Guide
pthread_join(tid1,NULL);
pthread_join(tid2,NULL);
my_printf ("\nMain Completed\n");
}
void sig_cld1(int signo)
{
my_printf("\nSignal received for Thread1 is %d\n",signo);
}
void sig_cld2(int signo)
{
my_printf("\nSignal received for Thread2 is %d\n",signo);
}
Example 89 (page 395) provides an example of SIGALRM handling. It creates two threads that
wait for a SIGALRM signal. The SIGALRM signal is delivered to the correct thread, and the
sighand1() and sighand2() functions define the actions to be taken. Sample output:
sigaction for thread1 returned 0
sigaction for thread2 returned 0
Signal received for thread1 is 14
sigsuspend for thread1 returned -1
sigwait returned 0
sigwait for thread2 returned for signal 14
Main Completed
394 Using the POSIX User Thread (PUT) Model Library