Jump to content

do sleep until file exists ?


Recommended Posts

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

I am experiencing heavy cpu load with this:

do

sleep(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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...