News:

Yahoo Groups closing on Dec 14th 2019

Main Menu

Wait period

Started by jcarreiro, February 27, 2004, 11:57:02 AM

Previous topic - Next topic

jcarreiro

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

Wilson Logan

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.

jcarreiro

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

Wilson Logan

I'll pass it on to the developer.

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

Thanks,

Wilson.

Alex Nechiporenko

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.
Best Regards,
Alex Y. Nechiporenko

jcarreiro

I know that, that's why I sugested the Timer Event after Wilson told me he was using VB6.

SMF spam blocked by CleanTalk