system wide mutex

Skip Montanaro skip at
Sun Feb 9 12:00:39 CET 2014

> Which one is most recommended to use for mutex alike locking to
> achieve atomic access to single resource:
> - fcntl.lockf
> - with O_SHLOCK and O_EXLOCK
> -
> -
> - any other ?

As the author of lockfile, I can tell you it only implements advisory
locking. All programs needing to access the locked resources must
cooperate. It also has bugs which have been reported which I have yet
to spend any time fixing.

Beyond that, your question isn't really detailed enough to answer
completely. You don't identify what sort of systems you need this to
work on (Windows, Mac, various flavors of Unix?), whether programs
written in other languages will be involved (you did say "system
wide"), and whether you need to use it in the face of network file
systems like NFS or Samba.


More information about the Python-list mailing list