Цитата(T0ohtik @ 29.5.2008, 21:17 ) | | Но сигнал почему то не передается. |
не удивительно
| Код | void sig_hndlr() { sleep(10); pthread_t FirstThread, SecondThread; pthread_create(&FirstThread, NULL, &Thread1, NULL); pthread_create(&SecondThread, NULL, &Thread2, NULL); pthread_join(FirstThread, NULL); pthread_join(SecondThread, NULL); }
int main() { struct sigaction action; pid_t pid; memset(&action, 0, sizeof(action)); action.sa_handler = &sig_hndlr; pid = fork(); if (pid == 0) { sigaction(SIGUSR1, &action, NULL); pause(); } else if (pid < 0) return errno; sleep(5); kill(pid, SIGUSR1) wait(NULL); return 0; }
|
|