Lock story

darcs-hash:20050104161033-d1718-df6013a8a853e05b58a37636ea01a115502dcc77.gz
This commit is contained in:
bernat 2005-01-04 17:10:33 +01:00
parent 13e14194c9
commit 98c2fe0277
2 changed files with 4 additions and 4 deletions

View file

@ -20,7 +20,7 @@ def wait_lock(lock_name, lock_comment='', d=None):
"""
from twisted.internet import reactor, defer
try:
make_lock(lock_name, lock_comment, quiet=True)
make_lock(lock_name, lock_comment, nowait=1, quiet=True)
# On a le lock
if not d:
# On est en mode synchrone
@ -36,7 +36,7 @@ def wait_lock(lock_name, lock_comment='', d=None):
reactor.callLater(0.2, wait_lock, lock_name, lock_comment, d)
return d
def make_lock(lock_name, lock_comment='',nowait=1, quiet=False) :
def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
""" Création d'un lock
si nowait=1 fait un sys.exit(254) quand un ancien lock actif est rencontré
"""
@ -53,7 +53,7 @@ def make_lock(lock_name, lock_comment='',nowait=1, quiet=False) :
try:
lockf(lock_fd_dl, LOCK_EX | LOCK_NB)
except IOError, e:
if e.errno not in [errno.EACCESS, errno.EAGAIN]:
if e.errno not in [errno.EACCES, errno.EAGAIN]:
raise
if nowait:
if quiet: