Perl-Sensitive Sunglasses | |
PerlMonks |
Re^5: Frustration with changing lock typeby hv (Prior) |
on Apr 14, 2004 at 13:02 UTC ( [id://345037]=note: print w/replies, xml ) | Need Help?? |
The issue is not about _this_ record, but that you may have screwed up another process trying to handle the _next_ one. I think this would happen only if you took more than 3 seconds to process the record, so that the next process may see that the timestamp is old and grab it anyway: if it gets the LOCK_EX in the interval between you closing the file and unlinking it, it will merrily truncate and rewrite the file without knowing that anything has changed under its feet. It may be that the effect under Win32 would be that the unlink() fails, so that the new process really does have the actual file still. On a *nix system, I think it would instead have a locked filehandle on a file that is no longer linked on the filesystem, and would therefore be in danger of clashing with the next process to come and get a lock. However truncating instead should (I think) be safe either way round. Hugo
In Section
Seekers of Perl Wisdom
|
|