using Timers

ambuli
ambuli used Ask the Experts™
on
Hi Experts,

I have to send messages to another process for displaying dialogs. When I send the display message I have to start a timer and wait for that particular time for a a response.  If I don't get the response then I have to send a message to cancel that dialog.  There might be multiple outstanding requests at a time.  I have a table to track the invokeIDs for my dialogs.  How can I use timer effectively to do this?
That is I have to send a request to display and start a timer So, do I have to have many timers to do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
jkr
Top Expert 2012

Commented:
What OS are you using?

Author

Commented:
I am using QNX, but a general idea is what I am looking for. Thank you

Author

Commented:
FYI:  POSIX timers are available in QNX
You can use only one timer:
- set the timer just a portion of particular time. (Exampler  particular time = 1s, period of timer is 100ms = 1/10 of particular time, n = 10).
- have a array store id of message and counter.
- have new message to send if it to array with counter= 0;
- in function timer: increase  counter of the all msg (
counter[i]++

Open in new window

). And if
counter[i]>n

Open in new window

(with n = particular time/  period of timer) -> the message is timeout.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial