note 96592 modified in function.sleep by danbrown
| From: | danbrown@php.net | Date: | Sat, 06 Mar 2010 18:16:33 +0000 |
| Subject: | note 96592 modified in function.sleep by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166737@lists.php.net to get a copy of this message | ||
Notice that sleep() delays execution for the current session, not just the script. Consider the
following sample, where two computers invoke the same script from a browser, which doesn't do
anything but sleep.
PC 1 [started 14:00:00]: script.php?sleep=10 // Will stop after 10 secs
PC 1 [started 14:00:03]: script.php?sleep=0 // Will stop after 7 secs
PC 2 [started 14:00:05]: script.php?sleep=0 // Will stop immediately
http://php.net/session_write_close may be used to
address this problem.
--was--
Notice that sleep() delays execution for the current session, not just the script. Consider the
following sample, where two computers invoke the same script from a browser, which doesn't do
anything but sleep.
PC 1 [started 14:00:00]: script.php?sleep=10 // Will stop after 10 secs
PC 1 [started 14:00:03]: script.php?sleep=0 // Will stop after 7 secs
PC 2 [started 14:00:05]: script.php?sleep=0 // Will stop immediately
http://dk.php.net/session_write_close may be
used to address this problem.
http://php.net/manual/en/function.sleep.php