Skip to content

Releases: havelessbemore/semafy

v2.2.0

17 Jun 20:08
Compare
Choose a tag to compare

What's New

  1. Adds the static ByteLength class property, which represents
    the amount of memory in bytes required by the class.

    new Mutex(new SharedArrayBuffer(Mutex.ByteLength));

    Updated classes include:

    • ConditionVariable
    • CountingSemaphore
    • Latch
    • Mutex
    • OnceFlag
    • RecursiveMutex
    • SharedMutex
    • SharedTimedMutex
    • TimedMutex
  2. Adds bitOffset validation to OnceFlag. Invalid values
    now throw a RangeError (e.g. when < 0 or >= 32).

Full Changelog: v2.1.0...v2.2.0

v2.1.0

13 Jun 14:43
Compare
Choose a tag to compare

What's New

Introduces synchronous method versions.

  • Sync methods use Atomics.wait, which may not be allowed on the main thread in a browser environment. In these cases, their existing async versions (e.g. lockSync -> lock) should be used.

  • Interfaces:

    • SyncBasicLockable
    • SyncLockable
    • SyncTimedLockable
  • Classes:

    • Mutex now extends SyncLockable.
    • RecursiveMutex now extends SyncLockable.
    • RecursiveTimedMutex now extends SyncTimedLockable.
    • TimedMutex now extends SyncTimedLockable.
    • UniqueLock now extends SyncTimedLockable.
  • Utilities:

    • lockGuardSync

Misc

New Contributors

Full Changelog: v2.0.7...v2.1.0

v2.0.7

15 May 14:17
a585b9d
Compare
Choose a tag to compare

What's New

  • Classes

    • MultiLock for managing multiple locks as one.
  • Utilities

    • lock() function for joint locking of multiple locks.

What's Changed

  • Fix bug in tryLock() utility function. Error was not being re-thrown if it occurred on the first lock.

Full Changelog: v2.0.6...v2.0.7

v2.0.6

13 May 19:01
Compare
Choose a tag to compare

What's New

  • Adds Latch class
  • Adds UniqueLock class
  • Adds OnceFlag class
  • Adds callOnce() function

What's Changed

  • CountingSemaphore constructor now alternatively accepts an initial value.
  • The maximum value for RecursiveMutex has changed to (2**31) - 1. It was previously Number.MAX_SAFE_INTEGER.

Breaking Changes

  • MAX class constants for CountingSemaphore and RecursiveMutex have been renamed to Max.

Full Changelog: v2.0.5...v2.0.6

v2.0.5

12 May 20:42
Compare
Choose a tag to compare

What's New

  • Add tryLock function for attempted joint locking of multiple locks.
  • Add MultiLockError class to collect and surface errors attempting to lock multiple locks.
  • Add MultiUnlockError class to collect and surface errors attempting to unlock multiple locks.

What's Changed

  • Make tryLock and tryLockShared methods non-blocking in SharedMutex class

Full Changelog: v2.0.4...v2.0.5

v2.0.4

10 May 18:00
Compare
Choose a tag to compare

What's Changed

  • Fix bug in lockGuard. Mutex unlock was not properly awaited on for mutexes with async unlocks.

Full Changelog: v2.0.3...v2.0.4

v2.0.3

10 May 16:57
Compare
Choose a tag to compare

What's New

  • Adds SharedTimedMutex class

What's Changed

  • Updates README.md

Full Changelog: v2.0.2...v2.0.3

v2.0.2

10 May 15:45
Compare
Choose a tag to compare

What's New

  • Interfaces:

    • BasicLockable
    • Lockable
    • SharedLockable
    • SharedResource
    • SharedTimedLockable
    • TimedLockable
  • Classes

    • RecursiveTimedMutex
    • SharedLock
    • TimedMutex
  • Utilities

    • lockGuard

Breaking Changes

This patch introduces breaking changes from prior 2.0.x versions. I understand this is not best practices and promise to avoid this from 2.1 onwards.

  • Remove .request, .requestFor, .requestShared and .requestUntil methods.

    • .request should be replaced by lockGuard.
    • .requestShared should be replaced by wrapping the shared mutex in a shared lock and then using lockGuard.
    • There are no replacements for .requestFor and .requestUntil at this time.
  • Rename classes

    • Mutex -> TimedMutex
    • Semaphore -> CountingSemaphore
    • MutexError -> LockError
    • MutexOwnershipError -> OwnershipError
    • MutexRelockError -> RelockError

Full Changelog: v2.0.1...v2.0.2

v2.0.1

09 May 23:33
Compare
Choose a tag to compare

What's Changed

  • Added RecursiveMutex class.
  • Removed ability to instantiate classes with Int32Array.
  • Removed .handle getter, replaced with .buffer and .byteOffset getters
  • tryLock methods now return false instead of throwing an error if lock already owned.

Given the very brief period since the previous version, this will be released as a patch, despite breaking changes.

Full Changelog: v2.0.0...v2.1.0

v2.0.0

09 May 19:42
72d283f
Compare
Choose a tag to compare

What's Changed

Complete library rewrite from scratch

Full Changelog: v1.0.5...v2.0.0