1. 首页
  2. 数据库
  3. 其它
  4. python thread 并发且顺序运行示例

python thread 并发且顺序运行示例

上传者: 2020-12-31 17:22:22上传 PDF文件 32.82KB 热度 12次
复制代码 代码如下:#-*- coding:utf-8 -*- import threading import time def fun(name, ls_name, front_thread = None): ””’ 线程启动函数 通过front_thread来使用线程有序的运行 ”’ time.clock() time.sleep(2) # 如果front_thread存在,则在front_thread运行完成后,才运行当前线程 if front_thread != None: front_thread.join() ls_name.append(name) print “thread %
下载地址
用户评论