Is it a timer_settime runtine's problem ?

135 views
Skip to first unread message

Eric

unread,
Feb 21, 2009, 10:13:46 AM2/21/09
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.

Eric

unread,
Feb 22, 2009, 5:04:27 AM2/22/09
to android-porting
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.

David Turner

unread,
Feb 22, 2009, 8:02:32 AM2/22/09
to android...@googlegroups.com
Looks like a bug in the implementation, I'll look into it

Eric

unread,
Feb 22, 2009, 9:35:08 AM2/22/09
to android-porting
Thanks for David Turner's quick response :)
Could you tell me the source code location when you confirm it's real
a defect and fix it ?

Thanks again .

lzk

unread,
Feb 23, 2009, 3:33:50 AM2/23/09
to android...@googlegroups.com
Hi all,
I want to debug c programs by gdbserver. But I do not know how to
setup IP address to G1 device. So I could not connect gdb to gdbserver which
is running on G1 device. Could you help me? Thanks.

Maxwell Li

unread,
Feb 23, 2009, 8:18:51 PM2/23/09
to android-porting

David Turner

unread,
Feb 24, 2009, 11:57:31 AM2/24/09
to android...@googlegroups.com
You can use "adb forward tcp:1234 tcp:1234" to forward the local port on your development machine to the local port 1234 on the device/emulator.
After that, you can do "target remote localhost:1234" in gdb to connect to your target through gdbserver.

Meryl Silverburgh

unread,
Feb 24, 2009, 12:24:45 PM2/24/09
to android...@googlegroups.com
Thanks. Can you please tell em if I can do the same for debugging
webkit on android?
Reply all
Reply to author
Forward
0 new messages