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

[Omaha.pm] Differences to expect when using flock() on different OS and Filesystems.



As an off-shoot of my fork()/wait() discussion, I began researching the flock() function so I can ensure that the processes don't step on each other if they try to update the same file.  In our code, 90% of the file updates in the section I'm working on are not going to conflict.  In the remaining code, there are a couple files that will expose a race condition, so some sort of file locking will be needed.

A co-worker cast a vague warning that the flock() implementation varies widely based on the OS and filesystem it's working on.  I Googled quite a bit last night and I can't find any specific examples of other warnings (and work-arounds).

This code is gonig to run on Unix based systems (Solaris, RedHat, SUSE, HPUX, AIX, etc) and the only OS-based Perl warnings I can find are related to how Perl reacts on Windows when compared to Unix. 

Has anyone run into examples of flock() failing subiltly (or not-so subtily) between various flavors of Unix and/or filesystems?

Thanks,

Dan

"Quis custodiet ipsos custodes?" (Who can watch the watchmen?) -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author)
** *** ***** ******* *********** *************