multiple instance on Unix

Batista, Facundo FBatista at uniFON.com.ar
Wed Sep 29 14:12:47 EDT 2004


#- If so, you could do something like this:
#- 
#- import time
#- import os
#- waiting_for_lock = 1
#- 
#- while waiting_for_lock:
#-     try:
#-         os.mkdir('/tmp/foo')
#-         waiting_for_lock = 0
#-     except OSError:
#-         print "could not create directory"
#-         time.sleep(1)
#- #do whatever you need one and only one process to do...

If you don't have the permissions to write in /tmp this will fail.

.	Facundo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040929/9c28e716/attachment.html>


More information about the Python-list mailing list