note 47167 added to function.usleep
| From: | brainstar at gmail dot com | Date: | Fri, 05 Nov 2004 00:40:09 +0000 |
| Subject: | note 47167 added to function.usleep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80103@lists.php.net to get a copy of this message | ||
usleep() in windows using PHP 5.0.2
It seems that usleep() in this config has a minimum sleep time of around 10 milliseconds. Thats
10,000 microseconds.
ie:
<?
set_time_limit(10);
while(1) {
echo ".";
usleep(1);
ob_flush();
}
?>
On windows this only results in about a thousand periods being displayed before the timelimit kills
the script. The CPU use is not hit at all. On any other platform this would try to send almost 10
billion periods and probably take a CPU hit in the process ;-)
This is worlds better than sleep(), but still doesn't hold a candle to usleep() on other
platforms.
----
Manual Page -- http://www.php.net/manual/en/function.usleep.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47167
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47167&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47167&report=yes
Search -- http://master.php.net/manage/user-notes.php