I am using POSIX call for timer that is timer_create(). Application requires large no of timers so i was testing different scenarios for that and i found that after "ULIMIT_SIGPENDING", create_timer() function all returns with error and error no is EAGAIN (errno 11). That means system has max no of signals are pending.
As i want to solve this problem, i went further in problem and i wrote a simple timer application in which there is very less probability of signal pending.
sudo code is as follow,
Code:
void CreateTimerFirstTime()
{
//create timer and on time out call function TimeOut()
}
void TimeOut
{
//create timer and on time out call function TimeOut()
//print timer no
}
with above exercise i came to know that ULIMIT_SIGPENDING is same as no of timers created and TimedOut, although after that create_timers() gives error "Resource temporarily unavailable"
Note : During application i have also checked file descriptor list by command "lsof" and that does not have any large no of file descriptors.
so my question is..
Why system is returning error that maximum signal is pending while every timer has Timedout properly ?
What is solution for this problem without making ULIMIT_SIGPENDING to unlimited ?
Now, if signal is pending in that application is there any way we can see those signal via any command or anything like that ?
Any help will be appreciated. Thank You
Edit 1 :
Further more, as per my third question i was finding way to see pending signal and i found out that there no pending signal.
Note : I am using SIGRTMIN signal.
so the question is why create_timer() giving EAGAIN error?
Every help is appreciated. Thank You
i used below code.
Code:
void GetAndPrintPendingSignal()
{
sigset_t waiting_mask;
int signalcount = 0 ;
//sigemptyset (&base_mask);
//sigaddset (&base_mask, SIGINT);
//sigaddset (&base_mask, SIGTSTP);
///* Block user interrupts while doing other processing. */
//sigprocmask (SIG_SETMASK, &base_mask, NULL);
/* After a while, check to see whether any signals are pending. */
sigpending (&waiting_mask);
printf("Singal Pending No :: %d\n",sigpending(&waiting_mask));
// printf("Singal Pending YES/NO :: %d\n",sigismember(&waiting_mask, SIGRTMIN));
while(1)
{
sigemptyset(&waiting_mask);
sigpending(&waiting_mask);
if(1 == sigismember(&waiting_mask, SIGRTMIN))
{
/* User has tried to kill the process. */
printf("Singal Pending No :: %d\n",signalcount++);
}
else
{
break;
}
}
}