note 8411 deleted from function.flock by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 19:08:35 +0000 |
| Subject: | note 8411 deleted from function.flock by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22078@lists.php.net to get a copy of this message | ||
I had to play around a bit with flock() until I understood the explanations on this page.
Here's what I figured out:
You use flock($fp,2) to lock a file while writing to it. If it is already locked the server seems to
wait until it's unlocked.
If you want instant feedback use flock($fp,6) which will return immediately if the file is already
locked. That's what LOCK_NB is all about.