#26449 [Opn->Fbk]: usleep doesnt work correctly
| From: | iliaa@php.net | Date: | Fri, 28 Nov 2003 19:01:25 +0000 |
| Subject: | #26449 [Opn->Fbk]: usleep doesnt work correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51245@lists.php.net to get a copy of this message | ||
ID: 26449
Updated by: iliaa@php.net
Reported By: marcus at quintic dot co dot uk
-Status: Open
+Status: Feedback
Bug Type: Unknown/Other Function
Operating System: Windows XP
PHP Version: 4.3.4
New Comment:
Try running the following:
php -r " var_dump(time(), usleep(10000000), time()); "
Previous Comments:
------------------------------------------------------------------------
[2003-11-28 11:25:36] marcus at quintic dot co dot uk
Doesnt work. I only put 100000 as an example (admittedly too small to
notice if you're watching it), I should have put 10000000 or something
- put it in a loop that repeats a few thousand times and it still
doesnt do anything.
------------------------------------------------------------------------
[2003-11-28 11:17:28] iliaa@php.net
Try making the delay longer, usleep(100000); will sleep for 1/10 of a
second and is very hard to notice.
------------------------------------------------------------------------
[2003-11-28 10:54:52] marcus at quintic dot co dot uk
Description:
------------
(I know the manual says it doesnt work, but it should work because the
Sleep function in windows works fine)
usleep doesnt work on windows XP (on all windows platforms?). For some
reason usleep returns immediately on windows and there doesnt seem to
be any way in php of delaying for less than a second without chewing
cpu cycles.
Having looked at the code behind the usleep function all it does is
call the win32 Sleep function which does work, so there must be a bug
stopping this from being called.
Reproduce code:
---------------
<?php usleep(100000); ?>
Expected result:
----------------
Should delay for 100000 microseconds.
Actual result:
--------------
Returns immediately with no delay.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26449&edit=1