Mutex class
Asynchronos style mutex lock
Signature:
export declare class Mutex<V = void>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Semaphore with capacity of 1 | |
(constructor)(value) | Constructs a new instance of the Mutex class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
_value | V | ||
canLock | boolean | check if mutex is available, returns true if it is not locked and frozen | |
frozen | boolean | unfreeze the mutex lock, see Semaphore.unfreeze() |
Methods
Method | Modifiers | Description |
---|---|---|
freeze() | freeze the mutex lock, see Semaphore.freeze() | |
lock(timeout) | acquire lock | |
schedule(fn) | Schedule a task to run when mutex is not locked. | |
tryLock() | synchronosly acquire lock | |
unfreeze() | unfreeze the mutex lock, see Semaphore.unfreeze() |