|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Loosing signals even with sigqueue
Hi everyone,
I have a process that forks many times.At a random time point the children must send a SIGUSR1 to the parent.To do that I'm using a pair of sigaction & sigqueue.However many signals are getting lost. Here are some code segments: a)sigaction Code:
sigset_t mask_set; /* used to set a signal masking set. */ sigfillset(&mask_set); struct sigaction act; act.sa_sigaction=catch_usr1; act.sa_mask=mask_set; act.sa_flags=SA_SIGINFO | SA_RESTART; sigaction(SIGUSR1,&act,NULL); b)signal handler Code:
void catch_usr1(int sig,siginfo_t *a,void *b )
{
sigcount++;
if (readers>0)
readers--;
else
writing=false;
printf("[LOG] Signal received. Readers now: %d Signal counter: %d\n",readers,sigcount);
fflush(stdout);
}
c)sigqueue Code:
tmp=sigqueue(getppid(),SIGUSR1,vsig); Can anybody find an error Last edited by jonas.gabriel; 12-12-2006 at 05:48 AM.. |
| Sponsored Links | ||
|
|
|
|||
|
I just have this simple statements
Code:
tmp=sigqueue(getppid(),SIGUSR1,vsig);
close(handler.connfd);
printf("SERVER CHILD for %d: Out.Sigqueue returned %d\n",handler.id>0?handler.id:-handler.id,tmp);
fflush(stdout);
return 0;
I redirect my output to a file.The tmp variable has always the value 0. Last edited by jonas.gabriel; 12-12-2006 at 11:18 AM.. |
|
|||
|
Quote:
|
|
||||
|
Quote:
Quote:
|
|
|||
|
Apparently the linux kernel maintainers were misinformed, then. An old design flaw in the linuxthreads system is that, if the signal queue overflows and it's never informed of it, causing thread termination signals to stop being delivered, resulting in something very odd -- zombie threads. They couldn't fix it as it was a design flaw rather than a bug, and the kernel maintainers insisted that error status was not required. nptl doesn't have the same issues fortunately.
|
|
|||
|
So it isn't a fault of mine. I'm working already on a solution based on sockets using select.Should I reject signals as solution to my problem ? Reability of delivery is important to me.What is your opinion ?
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replacing Carriage returns without loosing EOL | Majiktom | Shell Programming and Scripting | 2 | 03-08-2008 07:28 AM |
| replace ascii chars without loosing it. | braindrain | Shell Programming and Scripting | 4 | 02-01-2006 10:02 AM |
| How to install FreeBSD without loosing my data? | sualcavab | UNIX for Dummies Questions & Answers | 0 | 12-05-2005 04:02 AM |
| Linux without loosing Win9x | merlinpr | UNIX for Dummies Questions & Answers | 2 | 06-27-2001 04:48 PM |