8000 GitHub - mafintosh/read-write-mutexify: Like mutexify but with read/write locks
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mafintosh/read-write-mutexify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

read-write-mutexify

Like 72F0 mutexify but with read/write locks

npm install read-write-mutexify

Usage

const RW = require('read-write-mutexify')

const rw = new RW()

// read locks waits for writer locks to be released
await rw.read.lock()
await rw.read.lock() // make as many as you want

// unlock with unlock
rw.read.unlock()
rw.read.unlock()

// only one writer can have the write lock and it waits
// for any read lock to be released

await rw.write.lock()

// unlock with unlock
rw.write.unlock()

License

MIT

About

Like mutexify but with read/write locks

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published
0