X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/842dabf727814691bfd949ac4d910ce04c32b887..49a9dc7916fc6bf2f30c599753ff50e44044dd05:/e2reactor.py diff --git a/e2reactor.py b/e2reactor.py index 7caeb7f1..cca2f358 100644 --- a/e2reactor.py +++ b/e2reactor.py @@ -11,7 +11,7 @@ Maintainer: U{Felix Domke} import select, errno, sys # Twisted imports -from twisted.python import log, threadable, failure +from twisted.python import log, failure from twisted.internet import main, posixbase, error #from twisted.internet.pollreactor import PollReactor, poller @@ -27,6 +27,7 @@ POLL_DISCONNECTED = (select.POLLHUP | select.POLLERR | select.POLLNVAL) class E2SharedPoll: def __init__(self): self.dict = { } + self.eApp = getApplication() def register(self, fd, eventmask = select.POLLIN | select.POLLERR | select.POLLOUT): self.dict[fd] = eventmask @@ -35,7 +36,10 @@ class E2SharedPoll: del self.dict[fd] def poll(self, timeout = None): - r = getApplication().poll(timeout, self.dict) + try: + r = self.eApp.poll(timeout, self.dict) + except KeyboardInterrupt: + return None return r poller = E2SharedPoll() @@ -58,7 +62,8 @@ class PollReactor(posixbase.PosixReactorBase): else: if selectables.has_key(fd): del selectables[fd] - getApplication().interruptPoll() + + poller.eApp.interruptPoll() def _dictRemove(self, selectable, mdict): try: @@ -188,7 +193,7 @@ class PollReactor(posixbase.PosixReactorBase): self._disconnectSelectable(selectable, why, inRead) def callLater(self, *args, **kwargs): - getApplication().interruptPoll() + poller.eApp.interruptPoll() return posixbase.PosixReactorBase.callLater(self, *args, **kwargs) def install():