Queue shutdown

未關閉
#96,471 14 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python
領域
backend

研究方向

開始之前,請先查看連結的 pull requests 以及先前關於 Queue 終止的討論,因為這項工作已經在多個地方進行過探索。所要求的行為涵蓋 threading queue、multiprocessing queue 和 asyncio:關閉應拒絕後續的 put、解除等待者的阻塞,並在排空後讓 get 擲出例外,而 immediate=True 則跳過排空。

由索引模型根據 Issue 內容生成。

描述

stdlib topic-multiprocessing type-feature

Add a shutdown method to queue class (threading queue, multiprocessing, asyncio) which causes all future puts to raise (a queue.QueueShutdown) and all future gets once the queue is empty to also raise, unblocking all waiters. An optional argument immediate=True will skip the requirement for the queue to be empty.

This will enable producers and consumers to use the queue to know when to stop. This is important because both producers and consumers can be blocked waiting on the queue.

Previous discussion:

Linked PRs
  • gh-96474
  • gh-102499
  • gh-104225
  • gh-104228
  • gh-104230
  • gh-104750
  • gh-115265
  • gh-115838
  • gh-116699
  • gh-117621
  • gh-138828
主要語言
Python
星號
77.2k
分支
36k
平均合併
1 天 9 小時
30 天內合併 PR
558

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python/cpython 的其他 Issue

查看 python/cpython 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。