标签:thread target UI count pre done art time for
import threading
import time
def run (n):
semaphore.acquire()
time.sleep(1)
print("run threading :",n)
semaphore.release()
semaphore=threading.BoundedSemaphore(4)
for i in range(20):
t=threading.Thread(target=run,args=(i,))
t.start()
while(threading.activeCount != 1):
pass
else:
print("main threading done.....")
python - threading-semaphore 示例
标签:thread target UI count pre done art time for
原文地址:http://www.cnblogs.com/xiesongyou/p/7737425.html