Windows mutex to prevent multiple instances

Joseph A. Knapka jknapka at
Thu Aug 29 05:44:42 CEST 2002

Hans Nowak wrote:
> Samuel Bronson wrote:
> >   Use a lock file, you could call it '' and put the pid of your
> > app in it so it can serve double-duty.
> We considered using a file to mark that the program is running, but dismissed
> the idea because of the problems this method caused in other apps we've seen...
> file doesn't get deleted, etc.
> >   Obviously, you will need to have a path for it if you want it to
> > actually work.
> >   You may also wish to consider why it is so important that only one
> > instance exist at a time.
> It is important because the programs query the database, then write some stuff
> back; running it multiple times simultaneously can (and obviously will, as we
> have found) result in undesirable duplicate records.

Is there a reason you can't enforce the appropriate
constraints using DB keys?


-- Joe
  "I'd rather chew my leg off than maintain Java code, which
   sucks, 'cause I have a lot of Java code to maintain and
   the leg surgery is starting to get expensive." - Me

More information about the Python-list mailing list