摘要:
1 #include <string.h> 2 #include <pthread.h> 3 #include <semaphore.h> 4 #include <signal.h> 5 6 sem_t sem_meng; 7 8 void signalhandler ( int sig) 9 {10 sem_post(&sem_meng);11 printf("caught signal ok\n");12 } 13 14 int main(int argc, const char *argv[])15 {16 si 阅读全文
摘要:
等待信号端 1 #include <signal.h> 2 #include <stdio.h> 3 4 void handle(int sig,siginfo_t* value,void*useless) 5 { 6 printf("%d\n",value->si_value.sival_int); 7 } 8 9 10 int main(int argc, const char *argv[])11 {12 struct sigaction act;13 sigemptyset(&act.sa_mask);14 act.sa_sig 阅读全文