UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2006-11-24 11:58 AM

Gowrisubha.R
Member
Registered: 2005-11-14
Posts: 9

Re: unix signals

Hi,
In the following code, in the first two lines, I have added a signal SIGINT in the signal mask and in the next two lines I have made the signal to remove from the mask.

sigaddset(&toBlock, SIGINT);
sigprocmask(SIG_BLOCK, &toBlock, NULL);

sigaddset(&toBlock, SIGINT);
and call sigprocmask(SIG_UNBLOCK, &toBlock, NULL);

If the signal is added to a signal mask, whether I can handle the signal using any signal handling procedure?, or what will be happened if a signal is in the mask and if the signal is not in the mask?

Thanks
GS

Offline

#2 2006-11-24 06:48 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: unix signals

I'm not sure I'm properly understand your question...  But, if you block a signal, then
no you can't handle it via signal handler...  It's blocked...  Theoretically, when you
unblock it, any previously blocked signal should be delivered then, so your handler
would get called at that point...  (But, for normal Unix signals, you're likely to only
get a single signal delivered at that point, even if multiple have been sent while it
was blocked...)

Offline

Board footer

Powered by FluxBB