silver217 Posted August 20, 2007 Share Posted August 20, 2007 I am experiencing heavy cpu load with this: do sleep(1000) until FileExists('d:\aaa.log') is there a smarter way ? Link to comment Share on other sites More sharing options...
Gif Posted August 20, 2007 Share Posted August 20, 2007 (edited) I am experiencing heavy cpu load with this: do sleep(1000) until FileExists('d:\aaa.log') is there a smarter way ? of course it depends in the structure of the rest of your code but anyway i always try to avoid Do..Until, maybe this: While 1 If FileExists('d:\aaa.log') Then ExitLoop WEnd Edited August 20, 2007 by Gif Link to comment Share on other sites More sharing options...
silver217 Posted August 21, 2007 Author Share Posted August 21, 2007 of course it depends in the structure of the rest of your code but anyway i always try to avoid Do..Until, maybe this: While 1 If FileExists('d:\aaa.log') Then ExitLoop WEnd Thanks for your reply, Your suggestion gives here the same problem, maybe it is my computer only, but I don't know how to start resolving it. I wrote two test programs: Do sleep(1000) until fileexists('G:\aaa.txt') Exit and While 1 if fileexists('G:\bbb.txt') then ExitLoop WEnd Exit when I start the Process Explorer (ctrl-alt-del) then both programs show 95 to 99% CPU load. Anybody who can help me with this ? Link to comment Share on other sites More sharing options...
Generator Posted August 21, 2007 Share Posted August 21, 2007 Put Sleep(1) or Sleep(100) between each check. Link to comment Share on other sites More sharing options...
ChrisL Posted August 21, 2007 Share Posted August 21, 2007 I am experiencing heavy cpu load with this:dosleep(1000)until FileExists('d:\aaa.log')is there a smarter way ?There is nothing wrong with your method. You can try changing the Sleep() time but your code gives me a 0 CPU usage in task manager [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now