Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Timer expiry: (6 Items)
   
Timer expiry  
We are creating timer through timer_create API using 
       clock_id as CLOCK_REALTIME, 
       event type as SIGEV_THREAD,
       and have registered some function for notification
We start this periodic timer with timeout value of 1 sec.
We have observed that most of times our function registered for notification is called after 1 sec. But sometimes our 
function registered for notification is not called for several seconds (like 8-10 seconds).

What could be the reasons for this ?
Re: Timer expiry  
I don't see why it would be 8-10 seconds but I don't work for QSSL so can't answer further on that. If the problem's on 
your end my guess is you have a higher priority thread that runs READY every now and then for 8-10 seconds or an 
interrupt handler that you don't return from for 8-10 seconds or a misbehaving interrupt handler that's attached to the 
timer interrupt.

However, the Library Reference docs for sigevent under SIGEV_THREAD say "We don't recommend using this type of event. 
Pulses are more efficient." Creating a thread is a bit heavy handed, especially for a repeating timer. I know your timer
 is 1 second but I don't know what your allowable error is.

So I'd suggest just changing your code to have an always running thread with an infinite loop that`s blocked waiting for
 a pulse and use SIGEV_PULSE instead or if portability is an issue then have the running thread blocked on sigwaitinfo()
 and use SIGEV_SIGNAL instead.

-Steven D.
RE: Timer expiry  
Hello Aricent,

was this intended by you?

Bye,
 Christian


-----Original Message-----
From: ext Steven Dufresne [mailto:community-noreply@qnx.com] 
Sent: Tuesday, January 03, 2012 2:40 PM
To: ostech-core_os
Subject: Re: Timer expiry

I don't see why it would be 8-10 seconds but I don't work for QSSL so
can't answer further on that. If the problem's on your end my guess is
you have a higher priority thread that runs READY every now and then for
8-10 seconds or an interrupt handler that you don't return from for 8-10
seconds or a misbehaving interrupt handler that's attached to the timer
interrupt.

However, the Library Reference docs for sigevent under SIGEV_THREAD say
"We don't recommend using this type of event. Pulses are more
efficient." Creating a thread is a bit heavy handed, especially for a
repeating timer. I know your timer is 1 second but I don't know what
your allowable error is.

So I'd suggest just changing your code to have an always running thread
with an infinite loop that`s blocked waiting for a pulse and use
SIGEV_PULSE instead or if portability is an issue then have the running
thread blocked on sigwaitinfo() and use SIGEV_SIGNAL instead.

-Steven D.



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post90789
AW: Timer expiry  
Hi Christian,

Is your system time sometimes adjusted automatically? Try using CLOCK_MONOTONIC as the clock type.

Cheers,
Thomas

----- Originalnachricht -----
Von: Christian Scheuch [mailto:community-noreply@qnx.com]
Gesendet: Tuesday, January 03, 2012 05:32 AM
An: ostech-core_os <post90787@community.qnx.com>
Betreff: Timer expiry

We are creating timer through timer_create API using 
       clock_id as CLOCK_REALTIME, 
       event type as SIGEV_THREAD,
       and have registered some function for notification
We start this periodic timer with timeout value of 1 sec.
We have observed that most of times our function registered for notification is called after 1 sec. But sometimes our 
function registered for notification is not called for several seconds (like 8-10 seconds).

What could be the reasons for this ?



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post90787
RE: Timer expiry  
Hello Aricent,

was this intended by you?

Bye,
 Christian

-----Original Message-----
From: ext Thomas Haupt [mailto:community-noreply@qnx.com] 
Sent: Tuesday, January 03, 2012 3:05 PM
To: ostech-core_os
Subject: AW: Timer expiry

Hi Christian,

Is your system time sometimes adjusted automatically? Try using
CLOCK_MONOTONIC as the clock type.

Cheers,
Thomas

----- Originalnachricht -----
Von: Christian Scheuch [mailto:community-noreply@qnx.com]
Gesendet: Tuesday, January 03, 2012 05:32 AM
An: ostech-core_os <post90787@community.qnx.com>
Betreff: Timer expiry

We are creating timer through timer_create API using 
       clock_id as CLOCK_REALTIME, 
       event type as SIGEV_THREAD,
       and have registered some function for notification
We start this periodic timer with timeout value of 1 sec.
We have observed that most of times our function registered for
notification is called after 1 sec. But sometimes our function
registered for notification is not called for several seconds (like 8-10
seconds).

What could be the reasons for this ?



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post90787




_______________________________________________

OSTech
http://community.qnx.com/sf/go/post90793
Re: RE: Timer expiry  
Thanks Steven. Thanks Thomas for the reply.

Yes our system time is updated but update is not quite often.
We will try the suggested alternatives.

We were suspecting low virtual memory as cause for this. How can we know that timer was expired but our function was not
 called because temporarily enough memory was not available to create the threads as after few seconds (8-10 seconds) 
eventually our routine was called.