Greetings! My program has 100 timers running. If a timer expired which will generate a signal and it was mapped to a same function handler. All the timers are mapped to one function handler.
The problem is if the timer expires one at a time, the function handler called at a time. But if the 2 timers expires at a time, the function handler is called one time only instead 2 times.
Is it possible to invoke the function handler as many times based on timer expirary happens simultaneoulsy?
Here is the piece of code implemented..
int timer_start(int timer_id, int expiry_time) { /* Variable Declaration */ struct timespec ts, tm, sleep; sigset_t mask; siginfo_t info; struct sigevent sigev; struct sigaction sa; /* Set the signal handler to handle the SIGRTMIN signal */ sa.sa_flags = SA_SIGINFO; sigemptyset(&sa.sa_mask); sa.sa_sigaction = timer_handler; if(sigaction(SIGRTMIN, &sa, NULL) == -1) { perror("Sig action failed"); return -1; } sigev.sigev_notify = SIGEV_SIGNAL; sigev.sigev_signo = SIGRTMIN; sigev.sigev_value.sival_int = timer_id; /* Set the timeout values in the timer */ if(timer_settime(tid, 0, &ival, NULL) == -1) { perror("timer_settime"); return -1; } return 1; }
void timer_handler(int sing_no, siginfo_t *info, void *context) { /* Variable declaration */ /* Call to initiate the configuration function call */ } If anyone knows the solution to this problem please let me know. Regards Uma
--------------------------------------- Posted through