上一页 1 ··· 16 17 18 19 20
摘要: 》》》》线程中的queue 1,父线程中生成一个q,子线程可以直接对q中的数据进行访问,访问完后父线程可以对子线程放入的数据进行操作,即数据实现了共享 》》》》》》》》进程中的queue 1,区别线程中的queue和进程中的Queue的不同 》》》》》》》》》》》》》》》》Pipe 1,parent 阅读全文
posted @ 2017-12-11 23:06 cerofang 阅读(211) 评论(0) 推荐(0)
摘要: 1,实现了多线程的并发,主进程在等待各个线程执行结束之后才继续往下执行 2 ,t.join()让进程等待当前线程结束。 3 ,线程的实例 》》》》》》》》》》》》》线程2 1,类的方式定义多线程并发 》》》》》》》》线程3 1,t.setDaemon(True)#把当前线程设置为守护线程 2,thr 阅读全文
posted @ 2017-12-10 22:22 cerofang 阅读(164) 评论(0) 推荐(0)
摘要: 1 import threading,time 2 3 def run(n): 4 semaphore.acquire() 5 time.sleep(1) 6 print("run in the %s thread"%n) 7 semaphore.release() 8 9 if __name__ == '__main__': 10 ... 阅读全文
posted @ 2017-12-09 23:12 cerofang 阅读(123) 评论(0) 推荐(0)
摘要: import time,threadingevent = threading.Event()def lighter(): count = 0 event.set()#先设置绿灯 while True: if 5 < count and count < 10: event.clear()#把标志位清了 阅读全文
posted @ 2017-12-09 23:06 cerofang 阅读(496) 评论(0) 推荐(0)
上一页 1 ··· 16 17 18 19 20