摘要: 互斥锁 一、 代码展示 ① 没加锁(X) import threading num = 0 def write1(): global num i = 1 while i <= 1000000: num += 1 i += 1 print("result1:%d" % num) def write2( 阅读全文
posted @ 2020-05-04 11:36 油炸地狱 阅读(605) 评论(0) 推荐(0) 编辑
摘要: 多进程间的全局变量不共享 一、代码展示 import multiprocessing as mul_p import time egg1 = 1 def write(egg2, q): global egg1 print("write全局变量彩蛋[%s]..." % egg1) print("wri 阅读全文
posted @ 2020-05-02 16:17 油炸地狱 阅读(243) 评论(0) 推荐(0) 编辑