How do I force a single instance of a python app?

Moshe Zadka moshez at math.huji.ac.il
Sun Oct 29 09:34:33 EST 2000


On Fri, 27 Oct 2000, Alex Martelli wrote:

> "Mark Hammond" <MarkH at ActiveState.com> wrote in message
> news:xM2K5.894$Tq6.8420 at news-server.bigpond.net.au...
>     [snip]
> > The idea of creating a directory was one I saw in a very old source
> > control system.  They documented that they used a directory as a lock,
> > as it was the only reasonable, cross platform, atomic operation with
> 
> This classic approach is also exposed in Python documentation material,
> such as the talk Guido gave at SD '99 East; see "A simple lock solution":


It doesn't work in he face of crashing application, which is what the
original applicant asked.
A better solution would be to have a locking daemon. Connecting to a port
would be an atomic operation if the server is not multi-threaded.





More information about the Python-list mailing list