Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56769

Re: Inter-process locking

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Piet van Oostrum <piet@vanoostrum.org>
Newsgroups comp.lang.python
Subject Re: Inter-process locking
Date Sun, 13 Oct 2013 08:46:42 -0400
Lines 9
Message-ID <m261t1qqx9.fsf@cochabamba.vanoostrum.org> (permalink)
References <mailman.1025.1381541497.18130.python-list@python.org> <m2vc13rup4.fsf@cochabamba.vanoostrum.org> <mailman.1048.1381639375.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace individual.net eVQbSLmfijgHKcbumCQvWgaOy5HJxiIGQ2N/Ygl0s6J32QDIwB
Cancel-Lock sha1:LaYlvZdDHnWNO/piJdQUPxc6eRY= sha1:gud01TlYSrHuforbTmwzeAnRAVM=
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (darwin)
Xref csiph.com comp.lang.python:56769

Show key headers only | View raw


Jason Friedman <jsf80238@gmail.com> writes:

> The lockfile solution seems to be working, thank you.

There is one caveat, however. If a process that has the lock crashes without releasing the lock, the lock file will stay around and prevent other processes to acquire it. Then you will have to manually remove it. I generally prefer a solution where the pid of the locking process is written to the lock file, so that other processes trying to acquire the lock can find out if the process is still around and remove the lock file if not. I have seen such solutions on Unix systems. But I am not sure if this can be done in a platform independent way without the risk of race conditions. Maybe I have to find out.
-- 
Piet van Oostrum <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Inter-process locking Jason Friedman <jsf80238@gmail.com> - 2013-10-11 17:44 -0600
  Re: Inter-process locking Piet van Oostrum <piet@vanoostrum.org> - 2013-10-12 00:15 -0400
    Re: Inter-process locking Jason Friedman <jsf80238@gmail.com> - 2013-10-12 22:42 -0600
      Re: Inter-process locking Piet van Oostrum <piet@vanoostrum.org> - 2013-10-13 08:46 -0400
        Re: Inter-process locking Jason Friedman <jsf80238@gmail.com> - 2013-10-18 20:08 -0600

csiph-web