摘要: what did you learn from your last class?20:09:07abc360.Draven/PHH-HA04 ☠ 2018/4/9 20:09:07poop20:12:42abc360.Draven/PHH-HA04 ☠ 2018/4/9 20:12:42its so 阅读全文
posted @ 2018-04-09 20:39 夏晓旭 阅读(336) 评论(0) 推荐(0)
摘要: #coding=utf-8import multiprocessing as mpimport time def consumer(cond): with cond: print "consumer before wait" cond.wait() print "consumer after wai 阅读全文
posted @ 2018-04-09 14:00 夏晓旭 阅读(299) 评论(0) 推荐(0)
摘要: #coding=utf-8import multiprocessing as mp def write_file(content,lock): lock.acquire() with open(r"d:\\0409.txt",'a') as fp: fp.write(content+'\n') lo 阅读全文
posted @ 2018-04-09 11:11 夏晓旭 阅读(2853) 评论(0) 推荐(0)
摘要: Join()是主程序等我这个进程执行完毕了,程序才往下走 阅读全文
posted @ 2018-04-09 10:36 夏晓旭 阅读(6220) 评论(0) 推荐(0)
摘要: #coding=utf-8import multiprocessingimport osimport timeimport random def m1(x): time.sleep(random.random()*4) print "pid:",os.getpid(),x*x return x*x 阅读全文
posted @ 2018-04-09 10:34 夏晓旭 阅读(334) 评论(0) 推荐(0)
摘要: 先看不加锁的: #coding=utf-8from multiprocessing import Process,Lockimport time def l(num): #lock.acquire() #stime.sleep(2) print "Hello num:%s" %num #lock.r 阅读全文
posted @ 2018-04-09 10:13 夏晓旭 阅读(2939) 评论(0) 推荐(0)