Eric
unread,Feb 21, 2009, 10:13:46 AM2/21/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-porting
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.