Re: Re: Behavior of the sleep function?
| From: | Jeffry Killen | Date: | Thu, 12 Mar 2015 00:52:14 +0000 |
| Subject: | Re: Re: Behavior of the sleep function? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324627@lists.php.net to get a copy of this message | ||
On Mar 11, 2015, at 4:17 PM, Christoph Becker wrote:
Jeffry Killen wrote:Thank you kindly. This will probably good to know in the future. JKOn Mar 10, 2015, at 1:46 PM, Christoph Becker wrote:Ah, now I understand. Anyhow, sleep() does not use output buffering or has anything to do with it. If formerly printed output is not send to the browser, that is either caused by PHP[1] or by the webserver. You can try to flush()[2] the output before calling sleep(). [1] <http://php.net/manual/en/outcontrol.configuration.php> [2] <http://php.net/manual/en/function.flush.php>I just found <http://www.tuxradar.com/practicalphp/8/11/0>, where a very simplistic example of flock() in combination with sleep() is given. Please don't forget to "reply to all" next time.O.K. I looked at the link and that is essentially what my code is trying to do: I.E. obtain a lock, print some text and then call sleep. But the text that is supposed to be returned before the call to sleep() doesn't show up until the first query is done, then the second query returns (with, as you indicated, adding a call to flock in the second query handling code.) That is why I presumed that sleep() was using output buffering.