- 论坛徽章:
- 0
|
大虾帮忙看看,在新建的线程里等待信号,可是pause却不返回
main()
{
pthread_create(&t1, NULL, disp_words, (void *) &tlen);
/*delay.it_value.tv_sec = 1;
delay.it_value.tv_usec = 0;
delay.it_interval.tv_sec = 0;
delay.it_interval.tv_usec = 0;
ret = setitimer (ITIMER_REAL, &delay, NULL);
if (ret) {
printf("setitimer erro\n");
}*/
alarm(1);
pthread_join(t1, NULL);
printf("exit\n");
}
void* disp_words(void * a)
{
int b;
printf("Here is the thread\n");
if(signal(SIGALRM, show_handler)== SIG_ERR) {
printf ("Cannot handle SIGALRM!\n");
exit (EXIT_FAILURE);}
pause();
printf("Here is the end of thread\n");
} |
|