Constructor
new Condition(lockopt)
- Source:
- See:
-
- Python's asyncio.Condition
Example
const cond = new Condition();
await cond.acquire();
setTimeout(() => cond.notify(), 1000);
await cond.wait(); // will wait for 1000ms
// do work...
cond.release();
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
lock |
Lock |
<optional> |
A shared lock object that is used to synchronize multiple Conditions. |
Classes
Methods
(async) acquire()
- Source:
- See:
Acquire the internal lock.
locked() → {boolean}
- Source:
- See:
The internal lock state.
Returns:
- Type
- boolean
notify(nopt)
Wake up any awaiters using
wait
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
n |
Number |
<optional> |
1
|
The number of awaiters to wake up. |
notifyAll()
Wake up ALL awaiters using
wait
.
release()
- Source:
- See:
Release the internal lock.