Condition
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.
- 本质利用一个主锁, 加上N通知锁来实现
wait 步骤原理
- 创建通知锁 锁定状态的lock1
- 释放主锁
- 堵塞lock1.acquire(),相当如等待解锁
- lock1 解锁后, 锁定主锁
- wait 结束,继续执行后续操作,并释放主锁;
- 衍生出 Semaphore, Event
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。