📜  如何锁定写入变量线程python代码示例

📅  最后修改于: 2022-03-11 14:46:59.691000             🧑  作者: Mango

代码示例1
from threading import Lock, Thread
lock = Lock()
g = 0
lock.acquire()
g += 1
lock.release()