select: add missing get(block=..) parameter.

pull/255/head
David Wilson 7 years ago
parent ddf28987a0
commit 4bf3d01104

@ -151,7 +151,7 @@ contexts.
Result processing happens concurrently to new results arriving, so
:py:meth:`all` should always be faster.
.. py:method:: get (timeout=None)
.. py:method:: get (timeout=None, block=True)
Fetch the next available value from any receiver, or raise
:py:class:`mitogen.core.TimeoutError` if no value is available within
@ -162,7 +162,9 @@ contexts.
:param float timeout:
Timeout in seconds.
:param bool block:
If :py:data:`False`, immediately raise
:py:class:`mitogen.core.TimeoutError` if the select is empty.
:return:
:py:class:`mitogen.core.Message`
:raises mitogen.core.TimeoutError:

@ -113,12 +113,12 @@ class Select(object):
empty_msg = 'Cannot get(), Select instance is empty'
def get(self, timeout=None):
def get(self, timeout=None, block=True):
if not self._receivers:
raise Error(self.empty_msg)
while True:
recv = self._latch.get(timeout=timeout)
recv = self._latch.get(timeout=timeout, block=block)
try:
msg = recv.get(block=False)
if self._oneshot:

Loading…
Cancel
Save