http://defect.opensolaris.org/bz/show_bug.cgi?id=11784



--- Comment #6 from amaguire <alan.maguire at sun.com> 2009-10-07 15:00:21 UTC 
---
(In reply to comment #5)
> (In reply to comment #4)
> > What is wrong with doing it right now?  You don't know if there is an alarm
> > scheduled soon.  The event added could have been the one that was in the 
> > past
> > due to scheduling delays.
> 
> If the event we are enqueueing is the first event in the timed event queue,
> then it is scheduled to go off "when" seconds from now (event->event_time = 
> now
> + when).
> 
> If the first event in the timed event queue has 0 seconds remaining, then it's
> alarm must already be set, either in  nwamd_event_enqueue_timed() (if it was
> the first when it was enqueued) or in nwamd_event_enqueue_expired_events()
> (when events expiring before it were dequeued).

So I think what you're saying is that it's safe to do nothing if it's the case
that we're enqueuing a timed event and the next event on the pending event
queue is due now (since we've already set a SIGALARM for it). We'd do something
like:

/*
 * If we need to set a SIGALARM for the next pending event, set it now.
 */
nextalarm = e->event_time - now;
if (nextalarm > 0)
    (void) alarm(nextalarm)

Is that right?

-- 
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Reply via email to