timer_t invalid value?
John Whitmore
arigead at gmail.com
Fri Feb 7 14:44:46 EST 2014
Hi all, I've got some code, a protocol I wrote, from an embedded processor
which I'm trying to port to Linux User Space, (to run on a Raspberry
Pi). Going to get my embedded device talking to the RPi.
Fortunately I wrote the embedded code so can change it to better fit with the
Linux User Space. In addition I can write a shim layer between my protocol
code and Linux.
My question is about timer_t. I've been searching through documentation but
can't find mention of any value that is considered an invalid timer
identifier. My embedded code's timer creation function would be something like:
timer_id = start_timer(duration, expiry_function);
The returned timer_id if set to the invalid value has not been started. In
addition when an event occurs in the protocol if the timer_id is not that
invalid value then stop the timer. So the timer_id stored tells you if it's
valid and running. As soon as the timer expires the expiry function returns
the value to the INVLAID_TIMER_ID value.
>From what I can tell in Linux there is no such Invalid value. A timer_t is just
an integer and all values are valid. This being the case in my protocol code
I'd have to change it so all timer id's are valid and another variable would
have to store the status/validity of the timer variable. Is this the case?
Just wanted to confirm this before I go re-writing.
Hope that isn't considered off topic, it is linux programming related-ish.
More information about the Kernelnewbies
mailing list