摘要: 生产者消费者模型 import time,random from multiprocessing import Process,Queue def producer(name,food,q): for i in range(3): res='%s%s' %(food,i) time.sleep(ra 阅读全文
posted @ 2019-07-22 14:53 zhouhao666 阅读(254) 评论(0) 推荐(0) 编辑
摘要: from threading import Thread import time def task(name): print('%s is running' %name) time.sleep(2) print('%s is done' %name) if __name__ == '__main__ 阅读全文
posted @ 2019-07-22 10:31 zhouhao666 阅读(89) 评论(0) 推荐(0) 编辑
摘要: from threading import Thread import time def task(name): print('%s is running' %name) time.sleep(2) print('%s is done' %name) if __name__ == '__main__ 阅读全文
posted @ 2019-07-22 09:47 zhouhao666 阅读(144) 评论(0) 推荐(0) 编辑
摘要: from threading import Thread,Lock import time n=100 def task(): global n temp=n time.sleep(0.1) n=temp-1 if __name__ == '__main__': t_l=[] for i in ra 阅读全文
posted @ 2019-07-22 09:21 zhouhao666 阅读(76) 评论(0) 推荐(0) 编辑