Skip to main content

Home > flowp > Mutex

Mutex class

Asynchronos style mutex lock

Signature:

export declare class Mutex<V = void> 

Constructors

ConstructorModifiersDescription
(constructor)()Semaphore with capacity of 1
(constructor)(value)Constructs a new instance of the Mutex class

Properties

PropertyModifiersTypeDescription
_valueV
canLockbooleancheck if mutex is available, returns true if it is not locked and frozen
frozenbooleanunfreeze the mutex lock, see Semaphore.unfreeze()

Methods

MethodModifiersDescription
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()