首页 > 代码库 > python语法记录

python语法记录

class threading.Condition(lock=None)
This class implements condition variable objects. A condition variable allows one or more threads to wait until they are notified by another thread.

If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. 
Otherwise, a new RLock object is created and used as the underlying lock.

也就是说,如果condition构造函数lock参数为空的话,会自动创建可重入锁RLock

可重入锁RLock,同一线程可以多次获取(the same thread may acquire it again without blocking)。

 

python语法记录