system wide mutex

Asaf Las roegltd at gmail.com
Sun Feb 9 12:07:56 CET 2014


On Sunday, February 9, 2014 1:00:39 PM UTC+2, Skip Montanaro wrote:
> > 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

Hi Yes i realized that missed info. The lock is needed
for 2 independently spawned processes to update set of files and non 
non thread safe db 

/Asaf



More information about the Python-list mailing list