Код: Выделить всё
#include
#include
#include
void handler(int sig) {
printf("ctrl c\n");
}
void handler1(int sig) {
printf("user sig\n");
}
int main() {
struct sigaction a;
a.sa_handler = &handler;
sigemptyset(&a.sa_mask);
sigaddset(&a.sa_mask, SIGUSR1);
a.sa_flags = 0;
struct sigaction b;
b.sa_handler = &handler1;
sigemptyset(&b.sa_mask);
b.sa_flags = 0;
sigaction(SIGINT, &a, NULL);
sigaction(SIGUSR1, &b, NULL);
while (1) {
sleep(1);
raise(SIGUSR1);
}
return 0;
}
Код: Выделить всё
ctrl c
ctrl c
ctrl c
Код: Выделить всё
^Cctrl c
user sig
^Cctrl c
user sig
^Cctrl c
user sig
^Cctrl c
user sig
как мне поступить, что-то не так
Подробнее здесь: https://stackoverflow.com/questions/783 ... -c-program
Мобильная версия