Changeset 247:12a62baf908f for src/mlx/singleton.py
- Timestamp:
- 06/12/12 18:30:23 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/singleton.py
r182 r247 95 95 self._notifySingleton() 96 96 97 def close(self): 98 """Close the instance by closing the mutex.""" 99 if self._mutex: 100 win32api.CloseHandle(self._mutex) 101 self._mutex = None 102 97 103 def _getPipeName(self): 98 104 """Get the name of the pipe to be used for communication.""" … … 127 133 def __del__(self): 128 134 """Destroy the object.""" 129 if self._mutex:130 win32api.CloseHandle(self._mutex)135 self.close() 136 131 137 #---------------------------------------------------------------------------- 132 138 … … 196 202 else: 197 203 self._notifySingleton() 204 205 def close(self): 206 """Close the instance by closing the mutex.""" 207 if self._isSingle: 208 if self._lockFile: 209 self._lockFile.close() 210 self._lockFile = None 211 try: 212 os.remove(self._lockName) 213 except: 214 pass 215 try: 216 os.remove(self._socketName) 217 except: 218 pass 219 198 220 199 221 def _startSocketServer(self, raiseCallback): … … 224 246 def __del__(self): 225 247 """Destroy the object.""" 226 if self._isSingle: 227 self._lockFile.close() 228 try: 229 os.remove(self._lockName) 230 except: 231 pass 232 try: 233 os.remove(self._socketName) 234 except: 235 pass 248 self.close() 236 249 237 250 #----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.