Re: Behavior of the sleep function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mar 10, 2015, at 1:46 PM, Christoph Becker wrote:

Jeffry Killen wrote:

On Mar 10, 2015, at 11:40 AM, Christoph Becker wrote:

flock() implements *advisory* file locking, i.e. it works only if *all* file accesses use flock() to probe for a lock. So, basically, you have
to call flock($_fw, LOCK_EX) also for $_GET['tstNo'] == '2'.

Thank you for the info:

I am assuming that sleep uses output buffering, so it doesn't matter
completely when it is called(?)

I probably don't understand your statement/question.  Anyhow, sleep()
simply pauses execution of the script, independently of output buffering.

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.

Anyhow, I am making progress. Thank you for your help
JK

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux