PG Offline

PG Offline => Bug Report => Topic started by: jcarreiro on February 27, 2004, 11:57:02 AM

Title: Wait period
Post by: jcarreiro on February 27, 2004, 11:57:02 AM
During the wait period, the processor time spent by PG goes to 100%.

I don't know what language you're using to build the program, but if you can access the windows API, I sugest you use the SLEEP method.

OS: Windows XP
Title: Re:Wait period
Post by: Wilson Logan on February 27, 2004, 06:52:35 PM
We're using an algorithm like this:

StartTime = GetSystemTime

DO

DoEvents

WHILE GetSystemTime  < StartTime+Delay

The 100% CPU usage is a VB DoEvents bug.

I will pass your suggestion on though.

Thanks,

Wilson.
Title: Re:Wait period
Post by: jcarreiro on March 01, 2004, 11:18:22 AM
No Wilson, that's not a VB Bug, that's a programming error.

http://support.microsoft.com/support/kb/articles/Q158/1/75.asp


Since VB doesn't "easily" allows Multithreading you could create a timer and put that code there.

Sub Timer_Elapsed(..)

If( GetSystemTime  > StartTime+Delay  ) Then
 'Were DONE, let's start again.
End if

End Sub
Title: Re:Wait period
Post by: Wilson Logan on March 01, 2004, 01:33:20 PM
I'll pass it on to the developer.

I'll be glad if you're right :)

Thanks,

Wilson.
Title: Re:Wait period
Post by: Alex Nechiporenko on March 01, 2004, 02:17:33 PM
Quote from: jcarreiro on February 27, 2004, 11:57:02 AM

I don't know what language you're using to build the program, but if you can access the windows API, I sugest you use the SLEEP method.

OS: Windows XP

Sleep function can't be used in this case because user interface will be frozen by this API call.
Title: Re:Wait period
Post by: jcarreiro on March 01, 2004, 03:11:24 PM
I know that, that's why I sugested the Timer Event after Wilson told me he was using VB6.