Click here to Skip to main content
16,004,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: the more leaks...... Pin
valerie9925-Oct-05 10:51
valerie9925-Oct-05 10:51 
QuestionRe: the more leaks...... Pin
David Crow26-Oct-05 3:25
David Crow26-Oct-05 3:25 
GeneralRe: the more leaks...... Pin
krmed26-Oct-05 5:12
krmed26-Oct-05 5:12 
QuestionRe: the more leaks...... Pin
David Crow25-Oct-05 10:32
David Crow25-Oct-05 10:32 
Questionguarantee to run in a certain period Pin
LeeeNN25-Oct-05 8:14
LeeeNN25-Oct-05 8:14 
AnswerRe: guarantee to run in a certain period Pin
Roger Stoltz25-Oct-05 9:03
Roger Stoltz25-Oct-05 9:03 
AnswerRe: guarantee to run in a certain period Pin
Joe Woodbury25-Oct-05 12:01
professionalJoe Woodbury25-Oct-05 12:01 
AnswerRe: guarantee to run in a certain period Pin
Roger Stoltz25-Oct-05 22:56
Roger Stoltz25-Oct-05 22:56 
Joe Woodbury wrote:
the article referred to by Roger is out of date and makes several errors


If this is so, please provide some links to MSDN or similar. Otherwise this is just an opinion which I disagree with and my opinion is based on my own experience on various windows OS versions.

Joe Woodbury wrote:
a thread does not have to run for it's entire quanta


True. But this is not done by the OS scheduler. It requires the thread to call either ::Sleep(0) or one of the ::WaitForXXXObject functions.
For the thread to relinquish its time slice by calling ::Sleep(0) requires that there is another thread of equal or higher priority that is ready to run, otherwise the thread is resumed.
This is not a matter of opinion, you can read about it in MSDN[^].

Joe Woodbury wrote:
W2K and XP use a different resolution on timers


What timers? Is this another opionion or do you have links?
As an example I've tried the same code running on WinNT4 and WinXP with a better result regarding response time on an older P2 machine running WinNT4 than a fairly new P4 running WinXP using waitable timers.
Regardless of how I designed my executable this would not be the case if what you claim was the fact.

Joe Woodbury wrote:
it generally responds within 1ms of your ideal


This I have never experienced on any version of windows without the use of multimedia timers.
How have you measured this?

Joe Woodbury wrote:
even WM_TIMER is pretty accurate if you're talking 50ms


Do you really think he meant ±50ms when he has boosted both the priority of the process and the thread to "realtime"?
I get the impression that he want a timer event to occur every 50ms with the highest precision available.
To even mention WM_TIMER in such case is absurd since WM_TIMER is a low priority message and will only be generated if there are no other messages in the thread's message queue. This means that moving the mouse around above your window could delay the WM_TIMER message to be generated/handled.
Again this can be read in MSDN[^].

To use ::WaitForSingleObject to wait for a waitable timer could be a solution.
When the timer event is signalled, the waiting threads priority is boosted by 1 to make the scheduler run the waiting thread ASAP.

A better alternativ than ::GetTickCount() regarding measuring time is the use of ::QueryPerformanceCounter().
Don't make the mistake assuming that something has the same precision as the least significant bit of the value, i.e. ::Sleep(1) does not necessarily generate a delay of one millisecond.

--
Roger


It's supposed to be hard, otherwise anybody could do it!
GeneralRe: guarantee to run in a certain period Pin
Joe Woodbury26-Oct-05 0:22
professionalJoe Woodbury26-Oct-05 0:22 
QuestionDesign advice needed Pin
Keith Vitali25-Oct-05 8:03
Keith Vitali25-Oct-05 8:03 
AnswerRe: Design advice needed Pin
Achim Klein25-Oct-05 8:31
Achim Klein25-Oct-05 8:31 
AnswerRe: Design advice needed Pin
John R. Shaw25-Oct-05 9:03
John R. Shaw25-Oct-05 9:03 
GeneralRe: Design advice needed Pin
Keith Vitali26-Oct-05 9:15
Keith Vitali26-Oct-05 9:15 
AnswerRe: Design advice needed Pin
Joe Woodbury25-Oct-05 12:06
professionalJoe Woodbury25-Oct-05 12:06 
AnswerRe: Design advice needed Pin
User 58385225-Oct-05 17:21
User 58385225-Oct-05 17:21 
QuestionMalloc / Free problem Pin
Jader8925-Oct-05 6:45
Jader8925-Oct-05 6:45 
AnswerRe: Malloc / Free problem Pin
Roger Stoltz25-Oct-05 7:01
Roger Stoltz25-Oct-05 7:01 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:31
Jader8925-Oct-05 7:31 
AnswerRe: Malloc / Free problem Pin
Maximilien25-Oct-05 7:10
Maximilien25-Oct-05 7:10 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:33
Jader8925-Oct-05 7:33 
QuestionRe: Malloc / Free problem Pin
David Crow25-Oct-05 7:27
David Crow25-Oct-05 7:27 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:34
Jader8925-Oct-05 7:34 
QuestionRe: Malloc / Free problem Pin
David Crow25-Oct-05 9:27
David Crow25-Oct-05 9:27 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:34
Jader8925-Oct-05 9:34 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:39
Jader8925-Oct-05 9:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.