Ignore:
Timestamp:
06/12/12 18:30:23 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Hopefully fixed the problem of not restarting properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/singleton.py

    r182 r247  
    9595                self._notifySingleton()
    9696
     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
    97103        def _getPipeName(self):
    98104            """Get the name of the pipe to be used for communication."""
     
    127133        def __del__(self):
    128134            """Destroy the object."""
    129             if self._mutex:
    130                 win32api.CloseHandle(self._mutex)
     135            self.close()
     136               
    131137#----------------------------------------------------------------------------
    132138
     
    196202            else:
    197203                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               
    198220
    199221        def _startSocketServer(self, raiseCallback):
     
    224246        def __del__(self):
    225247            """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()
    236249               
    237250#----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.