()
| 189 | |
| 190 | |
| 191 | def _stop_writer_thread(): |
| 192 | global _writer_running |
| 193 | |
| 194 | _writer_running = False |
| 195 | # 唤醒 writer 线程让它能感知退出信号 |
| 196 | with _deque_condition: |
| 197 | _deque_condition.notify_all() |
| 198 | |
| 199 | if _writer_thread and _writer_thread.is_alive(): |
| 200 | _writer_thread.join(timeout=3.0) |
| 201 | |
| 202 | |
| 203 | # ----------------------------------------------------------------- |