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
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
del self.dict[fd]
def poll(self, timeout = None):
- return getApplication().poll(timeout, self.dict)
+ r = self.eApp.poll(timeout, self.dict)
+ return r
poller = E2SharedPoll()
poller.register(fd, mask)
else:
if selectables.has_key(fd): del selectables[fd]
+
+
+ poller.eApp.interruptPoll()
def _dictRemove(self, selectable, mdict):
try:
POLLIN=select.POLLIN,
POLLOUT=select.POLLOUT):
"""Poll the poller for new events."""
+
if timeout is not None:
timeout = int(timeout * 1000) # convert seconds to milliseconds
if why:
self._disconnectSelectable(selectable, why, inRead)
+ def callLater(self, *args, **kwargs):
+ poller.eApp.interruptPoll()
+ return posixbase.PosixReactorBase.callLater(self, *args, **kwargs)
def install():
"""Install the poll() reactor."""