@bradleymeck/thenables
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "@bradleymeck/thenables", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "some simple utilities for awaiting", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -62,1 +62,21 @@ # thenables | ||
``` | ||
# semaphore | ||
## semaphore.ExclusiveSemaphore | ||
The most general use Semaphore, it expects to stay in the same thread. | ||
```js | ||
const ExclusiveSemaphore = require('./semaphore').ExclusiveSemaphore; | ||
const semaphore = new ExclusiveSemaphore(+process.argv[2] || 1); | ||
;(async () => { | ||
let {unlock} = await semaphore; | ||
console.log('start: A'); | ||
await { | ||
then: f => setTimeout(f, 1000) | ||
} | ||
console.log('close: A'); | ||
unlock(); | ||
})(); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4740
81