Santhosh
Santhosh

Reputation: 955

Kill and signal issue in linux

We have a lib which sends kill(pid, SIGUSR2) signal to the mentioned pid which is running most of the times in our case. The process has signal command which has signal handling related to this signal.

I could see that this kill command is working and is returning success(0), but the corresponding signal handler is getting called some times and some times not.

What could be the reason for this inconsistency?

Upvotes: 0

Views: 144

Answers (1)

Santhosh
Santhosh

Reputation: 955

I got the solution to this, basically some other code is blocking the SIGUSR2 signal so i just unblocked it using sigprocmask(SIG_UNBLOCK, &set, NULL); and it worked.

The reason it happened only first time is the time duration it was blocked, basically they blocked for some time before unblocking and the code path execution here is that the first time this process is not able to pick the signal during that time.

Upvotes: 1

Related Questions