Looks like a bug in the implementation, I'll look into it

On Sun, Feb 22, 2009 at 11:04 AM, Eric <[email protected]> wrote:

>
> In  www.opengroup.org/onlinepubs/000095399/functions/timer_settime.html
> , it says "If the it_value member of value is zero, the timer shall be
> disarmed."
>
> But in my code above, the timer will not be disarmed but expired
> immediately.
> Why?
> Does some one can help me?
>
> thanks.
>
> On Feb 21, 11:13 pm, Eric <[email protected]> wrote:
> > hi,
> >
> > I want to disalarm(stop) an active timer which was created by
> > timer_create routine with the following code, but it seems doesn't
> > work.
> >
> > The timer will expire immediately after the second timer_settime() on
> > G1. I found it will be disalarmed  if i link these code with GNU's
> > librt.so library.
> >
> >
> -------------------------------------------------------------------------------
> >     struct   sigevent   se;
> >     memset(&se, 0, sizeof(se));
> >     se.sigev_notify = SIGEV_THREAD;
> >     se.sigev_notify_function = handler;
> >     se.sigev_value.sival_int = id;
> >     if(timer_create(CLOCK_REALTIME, &se, tid) < 0)
> >     {
> >         return   -1;
> >     }
> >     struct itimerspec ts, ots;
> >     ts.it_value.tv_sec = 5;
> >     ts.it_value.tv_nsec = 0;
> >     ts.it_interval.tv_sec = 0;
> >     ts.it_interval.tv_nsec = 0;
> >     if (timer_settime(*tid, 0, &ts, &ots) < 0)
> >     {
> >         return -1;
> >     }
> >
> >     /* now let's disalarm it */
> >
> >     ts.it_value.tv_sec = 0;
> >     ts.it_value.tv_nsec = 0;
> >     ts.it_interval.tv_sec = 0;
> >     ts.it_interval.tv_nsec = 0;
> >     if (timer_settime(*tid, 0, &ts, &ots) < 0)
> >     {
> >         return -1;
> >     }
> >
> ----------------------------------------------------------------------------------
> >
> > thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to