Remove special case for Waker construction

pull/35/head
David Wilson 7 years ago
parent a1044d8a6e
commit 569d157449

@ -668,7 +668,6 @@ class Waker(BasicStream):
set_cloexec(wfd) set_cloexec(wfd)
self.receive_side = Side(self, rfd) self.receive_side = Side(self, rfd)
self.transmit_side = Side(self, wfd) self.transmit_side = Side(self, wfd)
broker.start_receive(self)
def __repr__(self): def __repr__(self):
return 'Waker(%r)' % (self._broker,) return 'Waker(%r)' % (self._broker,)
@ -878,6 +877,7 @@ class Broker(object):
self._readers = set() self._readers = set()
self._writers = set() self._writers = set()
self._waker = Waker(self) self._waker = Waker(self)
self.start_receive(self._waker)
self._thread = threading.Thread(target=self._broker_main, self._thread = threading.Thread(target=self._broker_main,
name='econtext-broker') name='econtext-broker')
self._thread.start() self._thread.start()
@ -887,8 +887,7 @@ class Broker(object):
func(*args, **kwargs) func(*args, **kwargs)
else: else:
self._queue.put((func, args, kwargs)) self._queue.put((func, args, kwargs))
if self._waker: self._waker.wake()
self._waker.wake()
def start_receive(self, stream): def start_receive(self, stream):
"""Mark the :py:attr:`receive_side <Stream.receive_side>` on `stream` as """Mark the :py:attr:`receive_side <Stream.receive_side>` on `stream` as

Loading…
Cancel
Save