PID lockfile

Ben Finney ben+python at
Sun Mar 29 01:37:00 CET 2009

aahz at (Aahz) writes:

> In article <87iqlwvemo.fsf at>,
> Ben Finney  <bignose+hates-spam at> wrote:
> >In the case of the ‘lockfile’ library, Skip is aiming for a
> >cross-platform solution, with atomic behaviour; he has implemented
> >lock acquisition with a ‘link’ operation on Unix, and a
> >‘mkdir’ operation on Windows.
> >
> >But both of those, of course, create a new file. What I want is to
> >lock an existing file. Is ‘lockf’ particularly prone to
> >cross-platform troubles on Unix variants? (Since the “become a
> >daemon� pattern makes no sense on anything but Unix, I'm only
> >concerned with PID file behaviour that works on Unix.)

Hmm, looks like your client is messing up character encoding.

> IIUC, you must use something like Skip's trick to work correctly with
> NFS.

Okay. But is that something that needs to be accommodated with,
specifically, PID file handling? Why would a PID file ever need to be
on NFS storage instead of local?

 \     “The cost of a thing is the amount of what I call life which is |
  `\       required to be exchanged for it, immediately or in the long |
_o__)                                       run.” —Henry David Thoreau |
Ben Finney

More information about the Python-list mailing list