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


amaguire <alan.maguire at sun.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alan.maguire at sun.com


--- Comment #2 from amaguire <alan.maguire at sun.com> 2009-10-07 14:05:10 UTC 
---
(In reply to comment #1)
> No SIGALRM leads me to believe that the pending alarm is cancelled (the 
> pending
> alarm is cancelled by calling alarm(0)).  When we need to set the alarm, we
> look at the first event in the timed_event_queue and set the alarm to the time
> remaining for that event to occur.  What if the event is to occur "now", i.e.,
> 0 seconds are remaining?

good catch - according to the manpage:

If seconds is 0, a pending alarm request, if  any,  is  cancelled.

so if we are enqueuing a timed event exactly at the time that the pending event
at the head of the queue is due, we effectively cancel the timer:

    529     /*
    530      * This event may be the first event in the queue. (Re)set the
    531      * alarm to the remaining time of first event in the queue.
    532      */
    533     e = uu_list_first(timed_event_queue);
    534     (void) alarm(e->event_time - now);

If (e->event_time - now) == 0, we cancel the alarm. It might make sense to
ensure a minimal alarm time of 1sec, i.e.

nextalarm = e->event_time - now;
if (nextalarm > 0)
    (void) alarm(nextalarm)
else
    (void) alarm(1);

This would ensure that we do trigger a SIGALARM to catch the elapsed events.

-- 
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