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

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

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to