During use of timer_create in DCE environment , am facing issue like the signal handler is not invoke after specified time get expire. I have attached two file, one is my DCE script(Sbsn.cc) and other is my timer application(sm-v.c) file.I have run DCE script in both virtual time and real time. Below steps doing in timer application and DCE script.
Step 1: Registering a signal handler inside timer application.
int sigNo = SIGUSR1;
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = timerHandler;
sigemptyset(&sa.sa_mask);
sigaction(sigNo, &sa, NULL);
Step 2: Creating timer and Set and enable alarm.
te.sigev_notify = SIGEV_SIGNAL;
te.sigev_signo = sigNo;
te.sigev_value.sival_ptr = &timerID;
timer_create(CLOCK_REALTIME, &te, &timerID);
Step 3: Set time in timer
its.it_interval.tv_sec = (time_t)(intervalMS/ 1000L);
its.it_interval.tv_nsec = intervalMS % 1000000;
its.it_value.tv_sec = (time_t)(intervalMS/ 1000L);
its.it_value.tv_nsec = intervalMS % 1000000;
timer_settime(timerID,0, &its, NULL);
Step 4: Registering timer application inside the DCE script.
dce.SetBinary ("SbsTimer");
I have done some home work by looking into dce_timer_create() and dce_timer_settime() function inside dce-time.cc. I have found out that dce_timer_create() is not using the signal structure(struct sigevent *sevp) value inside the function. Same inside dce_timer_settime() call , it register a event handler and when the time expire call it will get call and re register itself and doing nothing other than this. Below code present inside DCE 1.8 and 1.9.
void
UnixTimerFd::TimerExpired (void)
{
if (!m_period.IsZero ())-----------Time to expire
{
m_timer = Simulator::Schedule (m_period,
&UnixTimerFd::TimerExpired,
this);
}
m_skipped++;
if (m_waiter != 0)
{
m_waiter->process->manager->Wakeup (m_waiter);
}
}
When i run the DCE script the timer handler(timerHandler) not getting invoked after waiting of long duration.
Please provide me a solution if anybody has any solution for it.
Thanks,
Jay