Esempio n. 1
0
 def release(self):
     """ Close the pid file, remove it and release any lock """
     try:
         name, self.name = self.name, None
         if name is not None and self._fp is not None and self._locked:
             _osutil.unlink_silent(name)
     finally:
         fp, self._fp, self._locked = self._fp, None, False
         if fp is not None:
             fp.close()
Esempio n. 2
0
 def bind(self):
     """ Bind to the socket path """
     old_umask = None
     try:
         if self._umask is not None:
             old_umask = _os.umask(self._umask)
         _osutil.unlink_silent(self._path)
         self._bound, _ = True, self.realsocket.bind(self._path)
     finally:
         if old_umask is not None:
             _os.umask(old_umask)
Esempio n. 3
0
 def close(self):
     """ Remove the socket path and close the file handle """
     _osutil.unlink_silent(self._path)
     self.realsocket.close()