Reads the next message from the queue. If no message is available in the queue, returns None. :param block: Blocks execution until a packet is available in the queue. Defaults to True. :type block: bool :param timeout: Controls how lon
(self, block=True, timeout=None)
| 796 | self.q.put(msg) |
| 797 | |
| 798 | def recv(self, block=True, timeout=None): |
| 799 | # type: (bool, Optional[int]) -> Optional[Any] |
| 800 | """ |
| 801 | Reads the next message from the queue. |
| 802 | |
| 803 | If no message is available in the queue, returns None. |
| 804 | |
| 805 | :param block: Blocks execution until a packet is available in the |
| 806 | queue. Defaults to True. |
| 807 | :type block: bool |
| 808 | :param timeout: Controls how long to wait if ``block=True``. If None |
| 809 | (the default), this method will wait forever. If a |
| 810 | non-negative number, this is a number of seconds to |
| 811 | wait before giving up (and returning None). |
| 812 | :type timeout: None, int or float |
| 813 | """ |
| 814 | try: |
| 815 | return self.q.get(block=block, timeout=timeout) |
| 816 | except queue.Empty: |
| 817 | return None |
| 818 | |
| 819 | |
| 820 | class TransformDrain(Drain): |