Changeset 3514

Show
Ignore:
Timestamp:
03/03/10 03:28:36 (14 years ago)
Author:
jerome
Message:

Try to do something about deadlock, not sure it happens there though...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tea4cups/trunk/tea4cups

    r3512 r3514  
    7676import pwd 
    7777import errno 
     78import random 
    7879import md5 
    7980import cStringIO 
     
    914915    def waitForLock(self) : 
    915916        """Waits until we can acquire the lock file.""" 
     917        random.seed() 
    916918        lockfilename = self.DeviceURI.replace("/", ".") 
    917919        lockfilename = lockfilename.replace(":", ".") 
     
    925927            try : 
    926928                # open the lock file, optionally creating it if needed. 
     929                self.LockFile = None 
    927930                self.LockFile = open(lockfilename, "a+") 
    928931 
     
    944947            except IOError : 
    945948                self.logDebug("I/O Error while waiting for lock %s" % lockfilename) 
    946                 time.sleep(0.25) 
     949                if self.LockFile is not None : 
     950                    self.LockFile.close() 
     951                time.sleep(0.25 + random.random()) 
    947952 
    948953    def readConfig(self) :