创建锁
mutex = threading.Lock()
锁定
mutex.acquire([timeout]) #timeout 秒后,获得锁则返回 True
释放锁
mutex.release()
mutex = threading.Lock()
mutex.acquire([timeout]) #timeout 秒后,获得锁则返回 True
mutex.release()
转载于:https://my.oschina.net/colben/blog/501737