Re: Practical flock() implementation

From: Date: Mon, 25 Jun 2001 21:50:06 +0000
Subject: Re: Practical flock() implementation
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-55160@lists.php.net to get a copy of this message
In article <030a01c0fd4a$0f797840$6401a8c0@Lynchux100>, ceo@l-i-e.com ("Richard Lynch") wrote: > > argument, so don't I *have* to fopen the file before going to flock()? Or > > should I fopen first in "r" mode, acquire the lock, then re-open in > > "w" > > mode, counting on the lock to stay in effect even though it's a different > > file pointer? > > Yup. You are holding the lock, and it's yours Kewl. That's just what I needed to know. Thanks, Manuel and Richard! > Possibly spurious NOTE: > > Most beginners who think they need a lock file are doing something that > should be in a database, but they are not familiar with databases, so use > files instead. > > Don't. > > The database guys have worked really hard to (A) take care of all these > locking issues and (B) make it just as easy to use as files. ...and (C) faster in most cases--as counter-intuitive as that seems--and (D) indexed, and (E) etc... No, not a spurious note at all. It's a good point that can save some poor soul (though unfortunately not me on this ocassion! <g>) a lot of grief. -- CC

« previous php.general (#55160) next »