Skip to content

Tag: handler

Signal Handler Behavior

I have just some questions about the system calls signal, kill and the signal handler. I have this code: 1) I don’t understand why the first printf in the first child, return -1 without a sleep(1) before…seems that the handler is executed after the beginning of the child. 2) When there is a kill t…

how to alternate continously Signal handler

I want to write a program in c for linux that catchs the first SIGUSR1 signal, ignores the second one and continue in this behaviour (catch-ignore) for the successive SIGUSR1 signals. I wonder how to keep alternating between the two handlers, because once i set the handler to SIG_IGN, the signal will be ignor…

“Alarm clock” message on linux

I’m working on a project written in C and I’m using alarms. In the beginning of the code I use sigaction() to initialize the alarm: Then I call the alarm with the alarm() function in a loop: The program sends the first alarm and runs the handler function, but when he sends the second one a message…