@tscommon/mutex
v0.0.3
Published
A mutual exclusion primitive useful for protecting shared data
Downloads
147
Maintainers
Readme
Mutex - API
A mutual exclusion primitive useful for protecting shared data.
This mutex will block async contexts waiting for the lock to become available. The mutex can be created via a new constructor. Each mutex has a type parameter which represents the data that it is protecting. The data can only be accessed through the RAII guards returned from lock
and tryLock
, which guarantees that the data is only ever accessed when the mutex is locked.