Example #1
0
 def __init__(self, map=None):
     self.closing = False
     self._eventfd = EventFD()
     try:
         asyncore.file_dispatcher.__init__(self,
                                           self._eventfd.fileno(),
                                           map=map)
     except:
         self._eventfd.close()
         raise
Example #2
0
class AsyncoreEvent(asyncore.file_dispatcher):
    def __init__(self, map=None):
        self.closing = False
        self._eventfd = EventFD()
        try:
            asyncore.file_dispatcher.__init__(
                self,
                self._eventfd.fileno(),
                map=map
            )
        except:
            self._eventfd.close()
            raise

    def writable(self):
        return False

    def set(self):
        self._eventfd.write(1)

    def handle_read(self):
        self._eventfd.read()

    def close(self):
        if self.closing:
            return
        self.closing = True
        try:
            self._eventfd.close()
        except (OSError, IOError):
            pass

        asyncore.file_dispatcher.close(self)
Example #3
0
class AsyncoreEvent(asyncore.file_dispatcher):
    def __init__(self, map=None):
        self.closing = False
        self._eventfd = EventFD()
        try:
            asyncore.file_dispatcher.__init__(
                self,
                self._eventfd.fileno(),
                map=map
            )
        except:
            self._eventfd.close()
            raise

    def writable(self):
        return False

    def set(self):
        self._eventfd.write(1)

    def handle_read(self):
        self._eventfd.read()

    def close(self):
        if self.closing:
            return
        self.closing = True
        try:
            self._eventfd.close()
        except (OSError, IOError):
            pass

        asyncore.file_dispatcher.close(self)
Example #4
0
 def __init__(self, map=None):
     self.closing = False
     self._eventfd = EventFD()
     try:
         asyncore.file_dispatcher.__init__(
             self,
             self._eventfd.fileno(),
             map=map
         )
     except:
         self._eventfd.close()
         raise