Re: Behavior of the sleep function?
| From: | Christoph Becker | Date: | Wed, 11 Mar 2015 23:17:57 +0000 |
| Subject: | Re: Behavior of the sleep function? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324623@lists.php.net to get a copy of this message | ||
Jeffry Killen wrote:
> On Mar 10, 2015, at 1:46 PM, Christoph Becker wrote:
>
>> 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.
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>
--
Christoph M. Becker