摘要:
首先看一个例子,让我们lock = threading.Lock() 时(代码第33行),程序会卡死在这里 如果我们将其改为lock = threading.RLock(),那么程序就能正常运行,这个就是递归锁 RLock() 阅读全文
摘要:
#!/usr/bin/env python import threading,time def run(n): # 申请锁 semaphore.acquire() time.sleep(1) print("run thre thread:%s\n"%n) # 释放锁 semaphore.release() if __name__ == "_... 阅读全文