- Timestamp:
- 08/30/06 01:53:12 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2983 r2996 129 129 self.logdebug("Waiting for lock...") 130 130 stillrunning = True 131 while 1 : 132 self.lockfile = open(self.lockfilename, "a+") 133 fcntl.lockf(self.lockfile, fcntl.LOCK_EX) # Will wait until lock available 134 self.lockfile.seek(0, 0) 135 try : 136 oldpid = int(self.lockfile.readlines()[-1].strip()) 137 except : 138 stillrunning = False 139 else : 140 try : 141 os.kill(oldpid, 0) 142 except OSError : 131 try : 132 while 1 : 133 self.lockfile = open(self.lockfilename, "a+") 134 fcntl.lockf(self.lockfile, fcntl.LOCK_EX) # Will wait until lock available 135 self.lockfile.seek(0, 0) 136 try : 137 oldpid = int(self.lockfile.readlines()[-1].strip()) 138 except : 143 139 stillrunning = False 144 if not stillrunning : 145 self.lockfile.truncate(0) 146 self.lockfile.seek(0, 0) 147 self.lockfile.write("%s\n" % self.pid) 148 self.lockfile.flush() 149 break 150 else : 151 time.sleep(0.1) 152 self.logdebug("Lock acquired.") 140 else : 141 try : 142 os.kill(oldpid, 0) 143 except OSError : 144 stillrunning = False 145 if not stillrunning : 146 self.lockfile.truncate(0) 147 self.lockfile.seek(0, 0) 148 self.lockfile.write("%s\n" % self.pid) 149 self.lockfile.flush() 150 break 151 else : 152 time.sleep(0.1) 153 except IOError : 154 self.logdebug("I/O Error while waiting for lock.") 155 else : 156 self.logdebug("Lock acquired.") 153 157 154 158 def discoverOtherBackends(self) : … … 1385 1389 wrapper.initBackendParameters() 1386 1390 wrapper.waitForLock() 1391 if os.environ.get("PYKOTASTATUS") == "CANCELLED" : 1392 raise KeyboardInterrupt 1387 1393 wrapper.saveDatasAndCheckSum() 1388 1394 wrapper.preaccounter = openAccounter(wrapper, ispreaccounter=1)