import concurrent.futures # 创建一个线程池 with concurrent.futures.ThreadPoolExecutor()asexecutor: # 提交任务给线程池 task1=executor.submit(func1, arg1) task2=executor.submit(func2, arg2) task3=executor.submit(func3, arg3) # 使用 wait 方法等待所有任务完成 concurrent.futures.wait([task1, tas...
import thread, time, random count = 0 def threadTest(): global count for i in xrange(10000): count += 1 for i in range(10): thread.start_new_thread(threadTest, ()) #如果对start_new_thread函数不是很了解,不要着急,马上就会讲解 time.sleep(3) print count #count是多少呢?是10000 * ...