diff --git a/CHANGELOG.md b/CHANGELOG.md index b5afdf8..710107f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.4.0 + +This is a full rewrite of the core implementation. + +* Allow negative values for semaphores. +* Allow weights for `semaphore.acquire` and `semaphore.runExclusive`. + A waiter will be dispatched once the value of the semaphore is greater or + equal to its weight. +* Add `semaphore.getValue` and `semaphore.setValue`. +* Allow weights for `semaphore.waitForUnlock`. The promise will only resolve + once the value of the semaphore is greater or equal to its weight. +* Only resolve `waitForUnlock` once no waiters remain (fixes #52). +* `waitForUnlock` times out if the `withTimeout` decorator is used. + ## 0.3.2 * Add `waitForUnlock` for waiting until a mutex/semaphore is free for locking, diff --git a/README.md b/README.md index 79c3ecd..c0d35ea 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,8 @@ try { `acquire` returns an (ES6) promise that will resolve as soon as the mutex is available. The promise resolves with a function `release` that -must be called once the mutex should be released again. +must be called once the mutex should be released again. The `release` callback +is idempotent. **IMPORTANT:** Failure to call `release` will hold the mutex locked and will likely deadlock the application. Make sure to call `release` under all circumstances @@ -321,7 +322,7 @@ try { available. The promise resolves to an array with the first entry being the current value of the semaphore, and the second value a function that must be called to release the semaphore once the critical operation -has completed. +has completed. The `release` callback is idempotent. **IMPORTANT:** Failure to call `release` will hold the semaphore locked and will likely deadlock the application. Make sure to call `release` under all circumstances