How to handle a "wait for file" situation

Mark Smith lists at futilism.com
Tue Jun 9 10:27:16 EDT 2009


Richard, it might help with cpu efficiency to use a different wait in  
the loop, polling every second, let's say:

repeat
	add 1 to count
	if there is a file xxx then exit repeat
	wait 1 second -- I'm assuming that this form of wait just idles the  
engine
	if count >= 18 then exit repeat -- ie.there's a problem
end repeat

Best,

Mark

On 9 Jun 2009, at 15:16, Richard Miller wrote:

> Not sure of the best way to handle this.
>
> I have a script that gets to a point in its processing where it  
> needs to wait up to 18 seconds for the appearance of a file. I know  
> I can use a simple "repeat until there is a file xxx" type of loop  
> (exiting from the loop if the time exceeds 18 seconds), but I'm  
> thinking there's a better way to handle this. This script is  
> running on a cgi server and there could be numerous simultaneous  
> scripts doing the same thing... so I want to minimize the load on  
> the CPU.
>
> Suggestions?
>
> Thanks.
> Richard Miller
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list