All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists matching topic concurrent-programming

Recently created
Least recently created
Recently updated
Least recently updated

timmy / 多執行緒工作佇列處理

0 likes
0 forks
1 files
Last active 10 months ago
這段 Python 程式碼 使用 多執行緒 (Threading) 與工作佇列 (Queue) 來 處理 30 個工作項目,確保所有工作都執行完畢後,才會顯示 "All work completed" 訊息。
concurrent-programming multithreading python queue task-processing threading
1 """
2 這段程式碼是建立一個執行緒來處理工作項目,並將 30 個工作項目放入工作佇列中。然後會等待所有工作都完成後才會印出 "All work completed" 的訊息。
3 """
4
5 import threading
6 import queue
7
8
9 # 定義一個函式來處理工作項目
10 def process_work_item(work_queue):
Newer Older

Powered by Opengist ⋅ Load: 20ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文