I was reading through the ioloop.py code and found nice the code that wakes
up the poll when it needs to stop the server. It works by sending a
character into pipe
which has one end in the poll list. However, shouldn't this fd be
registered to the READ
event instead of the WRITE event?
Like:
diff --git a/tornado/ioloop.py b/tornado/ioloop.py
index 6c4b727..15ef0b9 100644
--- a/tornado/ioloop.py
+++ b/tornado/ioloop.py
@@ -94,7 +94,7 @@ class IOLoop(object):
self._set_nonblocking(w)
self._waker_reader = os.fdopen(r, "r", 0)
self._waker_writer = os.fdopen(w, "w", 0)
- self.add_handler(r, self._read_waker, self.WRITE)
+ self.add_handler(r, self._read_waker, self.READ)
@classmethod
def instance(cls):
This is a really tiny issue because the poll timeout is set to 0.2
seconds anyway, but
wanted to point it out to make sure I understand it correctly.
Best Regards,
Tudor
--
Tudor Golubenco http://golubenco.org
Beware of bugs in the above code; I have only proved it correct,
not tried it. -- Donald Knuth