Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MultiThread and timer application

Status
Not open for further replies.

lilou

Programmer
Apr 12, 2001
3
FR
I used several threads in an application and i use a timer too.
I didn't used the MFC.
This timer causes an interruption funtion each 1 millisecond (ms).
So i count, for example, 10 ms, 5 ms even 500 ms.
The problem: I have use the SetTimer function which timer generates an interruption, but when
i count 500ms, the action appears only 2, 3 even 5 seconds later.

I have changed the funtion used to set the timer configuration. So i have used the SetWaitableTimer function which generates an interrution too. I have given the HIGHEST_PRIORITY priority to the handle
of the timer but it was the same work.

I don't where to search the solution...or how to give the priority






 
On multithreading is no waranty on which thread is running, which not. Is not the best idea to use threads on timer function. John Fill
1c.bmp


ivfmd@mail.md
 
I recommend you to use besides the timer:
- syncronization objects (events and/or critical sections)
(see the CreateEvent API for a start)
- the syncronization functions WaitForSingleObject and WaitForMultipleObjects

Hope this helps,s-) Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top