From:                   George Schlossnagle <[EMAIL PROTECTED]>
> >> The main problem appears to be that instead of taking a different
> >> branch if open() or flock() fails you continue on as if they had
> >> succeeded.
> 
> flock($fh,LOCK_EX ) is a blocking call, so it won't return until the
> lock is available.

.... OR AN ERROR OCCURES.

If the flock() fails Jeff prints an error message claiming that he 
aborts ... and continues as if the flock() succeeded.

The other problem is that he unlocks the files and THEN deletes the 
old one and renames the new one. So if process B tries to lock the 
old file while it's being processed by process A everything gets 
screwed up, because process B has the old file already open, so even 
if process A unlinks it, process B still has the old file, even 
though it's unnamed at the moment and will cease to exist as soon as 
it's closed.

Jeff, you have to use a separate lock file.

Or even better, consider using something else than a flat file 
operated by your own code.
DB_File as an array, DBD::SQLite, DBD::File, DBD::CSV, ... there are 
many options.

Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to