#26449 [Fbk->Opn]: usleep doesnt work correctly
| From: | marcus at quintic dot co dot uk | Date: | Fri, 28 Nov 2003 20:37:02 +0000 |
| Subject: | #26449 [Fbk->Opn]: usleep doesnt work correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51253@lists.php.net to get a copy of this message | ||
ID: 26449
User updated by: marcus at quintic dot co dot uk
Reported By: marcus at quintic dot co dot uk
-Status: Feedback
+Status: Open
Bug Type: Unknown/Other Function
Operating System: Windows XP
PHP Version: 4.3.4
New Comment:
Ok - I wont be able to check until after the weekend. I
tried the output of
<?php echo time(); usleep(10000000); echo time(); ?>
earlier (before submitting the bug) and it comes back with
the same time twice so unless var_dump gives you any extra
info that will help....
Previous Comments:
------------------------------------------------------------------------
[2003-11-28 14:01:25] iliaa@php.net
Try running the following:
php -r " var_dump(time(), usleep(10000000), time()); "
------------------------------------------------------------------------
[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