> Which one is most recommended to use for mutex alike locking to > achieve atomic access to single resource: > > - fcntl.lockf > - os.open() with O_SHLOCK and O_EXLOCK > - https://pypi.python.org/pypi/lockfile/0.9.1 > - https://pypi.python.org/pypi/zc.lockfile/1.1.0 > - 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. Skip -- https://mail.python.org/mailman/listinfo/python-list