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

@ -1113,7 +1113,7 @@ def del_machine(machine) :
machine.delete(res[0]) machine.delete(res[0])
except EnvironmentError, c : except EnvironmentError, c :
arg = u'--title "Destruction machine" ' arg = u'--title "Destruction machine" '
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0] arg+= u'--msgbox "ERREUR n°%s\n\n\n" 0 0' % c.args[0]
dialog(arg) dialog(arg)
return 1 return 1

View file

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