Re: usage of flock

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

 



Richard Lynch wrote:
On Fri, March 23, 2007 10:34 pm, Myron Turner wrote:
I've never used locks in PHP, but have used them in Perl.  In Perl a
lock is automatically released on exit or when the locked file is
closed.  Is that not the same in PHP?  According the the man page for
the C version of flock, it too releases the lock on close and C's exit
closes all streams.  So, Perl is consistent with that.  Just wondering
for myself it this isn't the case with PHP, in case I ever  want to
use
a lock.

It is the case, just as in C or Perl, that it's SUPPOSED to shut down
nicely and remove the lock...

When, not if, when, something goes terribly wrong, and you manage to
segfault PHP/Apache, do you want to have to remember to manually nuke
the flock somehow, or do you just want to code it from the get-go to
ignore locks older than X time? :-)

No matter how carefully you program your locks, sooner or later,
you'll have to have some "meta" programming about the locks to deal
with an inconsistent state of locks.

At least, that's been my experience so far...

It is something to think about. I've never had this problem but possibly because the sites haven't been high traffic enough.

Thanks,

Myron

--
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