in reply to Re^2: File Locking revisited
in thread File Locking revisited

You might try the code I posted a while back on this node -- it's a simple module that implements a nice semaphore file locking technique that I pulled out of a TPJ article (code provides url to the article, written by Sean Burke).

Regarding this part of the OP:

Let's say I have a system where more than one process will try to grab a pair of files (two associated files), read it/them, copy it/them elsewhere, and delete the originals. I want only one copy of the originals to be floating around. The initial solution was

get handles,
lock,
copy,
unlock,
unlink.

If I get what you're describing, multiple processes can be trying to access either of two files at any time, and will normally want to "open / read / close / make a copy elsewhere / unlink the original" on each file in succession.

With a semaphore file, it would look like this:

get lock on semaphore file for (file1, file2) { open read and copy close unlink } release semaphore file lock
So long as all the competing processes are set to use the same semaphore file, this will assure that only one process at a time can do anything at all with the two target data files.