At 00:51 08.11.2002, Charles Wiltgen said:
--------------------[snip]--------------------
>Example:   while(!file_exists("index.php") { clearstatcache(); }
>           while(filesize("index.php" < 10) { clearstatcache(); }
--------------------[snip]-------------------- 

To be more effective, and to allow the OS to do something else while you're
waiting at the file, your script should sleep for some microseconds... this
will release the time slice your script is occupying and allow other things
to happen, without having the cpu going up to 100%.

        while(!file_exists("index.php") { usleep(100); clearstatcache(); }
        while(filesize("index.php" < 10) { usleep(100); clearstatcache(); }

This will sleep  for 0.1 seconds, not really notable. Note that I put the
call to clearstatcache() _after_ the sleep...


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to