🧪 Add new concurrent test directory

This commit is contained in:
2026-05-27 00:43:36 +08:00
parent 8d3c2a291d
commit bbdab15a26
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Any
def get_item(item: Any) -> str:
pass
def main():
items = [1, 2, 3, 4]
result = []
with ThreadPoolExecutor(max_workers=8) as executor:
futures = []
for item in items:
futures.append(executor.submit(get_item, item))
for future in as_completed(futures):
result.append(future.result())
print(result)
if __name__ == '__main__':
main()