multiple instance on Unix
zanesdad at bellsouth.net
Wed Sep 29 19:59:30 CEST 2004
Nigel King wrote:
> I have (my son has!) implemented protection against multiple instances
> causing havoc by creating a directory. This fails if it exists and
> thus in a single instruction one gets both the acquire and the test.
> Windows has it's mutex which solves the problem. Is there any better
> version for UNIX.
> Nigel King
Could you explain a little better what you're trying to do? I'm
guessing that you (your son - I'm looking forward to that day, myself )
have multiple Python processes and you want only one process to be able
to create a directory?
If so, you could do something like this:
waiting_for_lock = 1
waiting_for_lock = 0
print "could not create directory"
#do whatever you need one and only one process to do...
More information about the Python-list