WaitKeyDown busy-waits

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
miron

WaitKeyDown busy-waits

Post by miron » Sat Jun 14, 2003 7:48 am

When I use WaitKeyDown, the CPU utilization goes to 100%. Needless to say, this is not good for performance of other applications.

Is there a workaround or a fix for this?

I can be contacted at:
[email protected]

I am using the latest version - 7.2.036

Thanks!

JonHodgson
Newbie
Posts: 12
Joined: Wed Mar 02, 2005 9:32 pm

Post by JonHodgson » Fri Mar 04, 2005 6:27 am

Ditto... any word on this?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Mar 04, 2005 8:02 am

Well. It is a tight loop. Inside which it does pretty much nothing. So you'd expect this. But will look and see if there is any way to avoid this. Probably the only way would be to slow down the loop and have it only check for the key press at millisecond intervals.
MJT Net Support
[email protected]

JonHodgson
Newbie
Posts: 12
Joined: Wed Mar 02, 2005 9:32 pm

Post by JonHodgson » Fri Mar 04, 2005 2:27 pm

I think this should be by default tuned a bit so as not to spike the CPU, but maybe this could also be a user parameter WKD_DELAY which could be tuned to further adjust the behavior, so maybe i would extened it to 10ms on a slower machine etc.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Mar 04, 2005 2:31 pm

Hi,

We've improved things in the latest release (7.3.10.5 released today) by forcing the app to sleep for 250 milliseconds at each loop iteration. This makes a significant improvement. This should actually have been done when the function was created but it somehow got overlooked. All loops within Macro Scheduler should yield to the processor within each loop iteration to ensure it doesn't lock up the CPU.
MJT Net Support
[email protected]

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts