timer_create problem

by pavan savoy » Wed, 03 Dec 2008 20:04:44 GMT


Sponsored Links
 Hi,

I am trying to port a code which has a timer_create

I get an EINVAL error, which suggests that there isn't a defined clock ID,
However I do see a definition for CLOCK_REALTIME,
What's happening, the second argument, that of sigevent seems ok in my case,
and the 3rd argument is returned..

So is this a problem with the 1st argument, If so, why is it occuring ? even
thou' CLOCK_REALTIME is defined ??

regards,
Pavan

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by David Turner » Wed, 03 Dec 2008 22:05:23 GMT


 Can you give more details on how you setup your timer. For the record,
SIGEV_THREAD timers are not supported on the G1.
This will be fixed soon in an upcoming update to the system code though.

On the other hand, it should be relatively easy to work-around the issue by
creating a thread that does the wait and function callback (which is
essentially what the implementation is going to do anyway).

If this is not a SIGEV_THREAD timer, please provide a small test case to
reproduce the issue, and I'll look into it





--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 


Sponsored Links


timer_create problem

by pavan savoy » Wed, 03 Dec 2008 22:09:20 GMT


 Hi,

About to mail that,

So I suppose the problem is not with the CLOCK_REALTIME, but with
SIGEV_THREAD, I have a SIGEV_THREAD unfortunately, now trying out with
SIGEV_SIGNAL, just to make sure, that's the problem...

Here is how I setup...

    evp.sigev_value.sival_int = *timerHandle; // pass the handle as argument
    evp.sigev_notify_function = TimerHandlerFunc;
    evp.sigev_notify_attributes = NULL;
    evp.sigev_notify = SIGEV_THREAD;

    rc = timer_create(CLOCK_REALTIME, &evp, &timerParams[idx].timerId);








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by pavan savoy » Wed, 03 Dec 2008 23:55:54 GMT


 Well, Only SIGEV_NONE seems to be working .....

Can I expect a fix anytime soon ? Or else should I start working on a
work-around ??

regards,
Pavan







--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by David Turner » Thu, 04 Dec 2008 01:16:02 GMT


 hmmm, SIGEV_SIGNAL should be working. Do you have a test case that shows it
doesn't ? (stupid question, is the signal properly unblocked ?)

Apart from that, I really can't give you any ETA, so if it's urgent to you,
I recommend to use the "create-your-own-waiting-thread" approach instead.








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by pavan savoy » Thu, 04 Dec 2008 15:31:45 GMT


 i,

Its some-one else's code & its huge, anyways,
the functionality doesn't seem to break if I use SIGEV_NONE.
Should I expect it to break ? Since the code doesn't really depend on
SIGEV_THREAD specifically [I may be wrong..]

Anyway, I'll get back as to why the SIGEV_SIGNAL isn't working, all I know
is, I get a timer_create error itself.
i.e EINVAL - Invalid argument.

So I am not sure how to actually test its working :(

regards,
Pavan

On Wed, Dec 3, 2008 at 7:15 PM, David Turner <[EMAIL PROTECTED]> wrote:


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



timer_create problem

by David Turner » Thu, 04 Dec 2008 21:56:37 GMT


 he functionality might not break if the callback is used to handled
exceptional signals, i.e. that doesn't necessarily mean that using a
SIGEV_NONE won't introduce a hideous bug.
Do you know exactly what the signal callback function does ?

can you provide a small code extract that shows how you setup your call for
SIGEV_SIGNAL timer creation ?

thanks in advance

On Thu, Dec 4, 2008 at 7:31 AM, pavan savoy <[EMAIL PROTECTED]> wrote:


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



timer_create problem

by pavan savoy » Fri, 05 Dec 2008 18:39:30 GMT


 i,

Where should I be looking, if I want to see support for SIGEV_THREAD.

I am still trying to setup the SIGEV_SIGNAL, it seems it does work, the
mistake was mine, but even then aren't they system calls, and shouldn't I be
looking in the kernel for implementation ??


regards,
Pavan

On Thu, Dec 4, 2008 at 1:56 PM, David Turner <[EMAIL PROTECTED]> wrote:


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



timer_create problem

by David Turner » Fri, 05 Dec 2008 21:46:51 GMT


 t will appear on the open-source git server soon, but I can't give an ETA
for this.

otherwise, this involves modifying the C library. SIGEV_THREAD timers are
not supported by the Linux kernels.
Instead, the C library must implement them. In the case of Bionic, this is
done with one plain pthread per timer,
which essentially calls pthread_cond_wait() in a loop.

On Fri, Dec 5, 2008 at 9:39 AM, pavan savoy <[EMAIL PROTECTED]> wrote:


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



timer_create problem

by pavan savoy » Fri, 05 Dec 2008 22:03:46 GMT


 ey thanks for the quick response..
However got the statically linked app working, So I won't be waiting on it.

Thanks,
Pavan

On Fri, Dec 5, 2008 at 1:46 PM, David Turner <[EMAIL PROTECTED]> wrote:


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



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 03:14:02 GMT


 hi,

i played with timer_create routine with the following code. it seems
the timer is working, but the cpu utilization is really high(over 90%)
if i run "top". Any idea what's going on on G1?

Thanks!

-----------------------------------------------------------------------------------------------------
        se.sigev_notify = SIGEV_THREAD;
        se.sigev_notify_function = timer_handler;
        se.sigev_signo = SIGUSR1;
        timer_create(CLOCK_REALTIME, &se, &tid);

        memset(&ts, 0, sizeof(struct itimerspec));
        ts.it_value.tv_sec = 0;
        ts.it_value.tv_nsec = 30000000;
        ts.it_interval.tv_sec = 0;
        ts.it_interval.tv_nsec = 30000000;
        result = timer_settime(tid, 0, &ts, 0);

--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Mon, 16 Feb 2009 09:31:58 GMT


 this one's for me :-)

Can you send me a small compilable test program to reproduce this (it'd be
much better for me since
I don't know what your timer_handler function is doing there).

It might be a bug in the SIGEV_THREAD timer implementation, I checked and
tested it for correctness but didn't look at CPU usage, I admit.

By the way, sigev_signo isn't used with SIGEV_THREAD timers.

On Mon, Feb 16, 2009 at 4:13 AM, henry.lon...@gmail.com <




--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Mon, 16 Feb 2009 09:50:02 GMT


 ok, I found the bug in the timer implementation, a fix is coming soon.






--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 19:48:37 GMT


 That's great. I found similar problem for SIGEV_SIGNAL. Could you
please let me know when the fix is released?

Thanks!





--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 19:57:10 GMT


 That will be great if you could also mention the source code location
of the fix so that i could make sure i have the fix once you publish
it.

Thanks again!





--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Other Threads

1. frequent c2dm message request

hi all,

I had develop a app that allow user to request info from their phone
based on chrometophone example.
Everything is working well but i noticed that c2dm message only sent
once to the device and subsequence c2dm will only reach phone after
screen unlock.

This make me annoy as my app required to get data from phone without
unlock screen multiple times.
Anyone can help on this?

Thanks and sorry for my bad English.

-- 

2. "Hello android "

Hello everybody

Im a beginner in Android platform, i read docs about Android ,i installed
Eclipse with ADT plugin and i installed all avalible targets.After that i
added Virtual devices ,i wanted test all this with "Hello android" App ,the
code have no errors and when i execute it the emulator appears but instead
of having "hello android " on the screen of the emulator ,im having a black
screen with a wrting "ANDROID_"....,and i really dont know what is wrong!


Can anyone tell me what could be the problem ?

Thanks

-- 

3. Live careers in Management work.

4. "IOException" in getFromLocation in android2.2

5. Google maps api update

6. Sensor usage Battery drain

7. Java Tutorial to Retrieve a Friends Location - Latitude?