refactor: unify doh executor shutdown

This commit is contained in:
jxxghp
2026-08-24 15:49:19 +08:00
parent e9053a6562
commit 41b1460b60
9 changed files with 256 additions and 101 deletions
+11
View File
@@ -101,3 +101,14 @@ def test_thread_helper_shutdown_waits_for_worker_after_future_completion():
callback_release.set()
assert executor.shutdown_bounded(timeout=1) is True
def test_owned_executor_preserves_standard_shutdown_contract():
"""旧调用方直接使用 pool.shutdown(wait=True) 时不得与 owner 回调互锁。"""
executor = thread_module._OwnedThreadPoolExecutor(max_workers=1)
future = executor.submit(lambda: "done")
executor.shutdown(wait=True)
assert future.result(timeout=1) == "done"
assert executor.accepting is False