等待队列内的数据被取走
(self, timeout=None)
| 211 | return [] |
| 212 | |
| 213 | def wait_empty(self, timeout=None): |
| 214 | """等待队列内的数据被取走""" |
| 215 | with self.not_full: |
| 216 | if self._qsize() == 0: |
| 217 | return |
| 218 | |
| 219 | if timeout is None: |
| 220 | self.not_full.wait() |
| 221 | elif timeout < 0: |
| 222 | raise ValueError("'timeout' must be a non-negative number") |
| 223 | else: |
| 224 | self.not_full.wait(timeout) |
| 225 | |
| 226 | def _init(self, maxsize): |
| 227 | self.queue = [] |