From e5b2af0352bcc127555cb26af068253939ea2146 Mon Sep 17 00:00:00 2001 From: Devin Ivy Date: Thu, 23 Apr 2026 18:28:06 -0400 Subject: [PATCH] chore: version 1.3.0 --- .changeset/try-lock-variants.md | 23 ----------------------- CHANGELOG.md | 24 ++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 .changeset/try-lock-variants.md diff --git a/.changeset/try-lock-variants.md b/.changeset/try-lock-variants.md deleted file mode 100644 index 94f503d..0000000 --- a/.changeset/try-lock-variants.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -'moroutine': minor ---- - -Synchronous `try*` variants for shared locks - -**New methods on `Mutex` and `RwLock`**: - -```ts -// Non-blocking, single-attempt acquisition. -// Returns a disposable guard on success, `null` on contention. -mutex.tryLock(); // MutexGuard | null -rwlock.tryReadLock(); // ReadGuard | null -rwlock.tryWriteLock(); // WriteGuard | null -``` - -Each makes a single atomic CAS attempt — no waiting, no retry. Composes with `using` since `null` skips dispose registration: - -```ts -using guard = mu.tryLock(); -if (!guard) return; // held elsewhere, nothing to dispose -// ...critical section; auto-unlock on scope exit -``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 24913eb..3fc5f0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # moroutine +## 1.3.0 + +### Minor Changes + +- c9a1794: Synchronous `try*` variants for shared locks + + **New methods on `Mutex` and `RwLock`**: + + ```ts + // Non-blocking, single-attempt acquisition. + // Returns a disposable guard on success, `null` on contention. + mutex.tryLock(); // MutexGuard | null + rwlock.tryReadLock(); // ReadGuard | null + rwlock.tryWriteLock(); // WriteGuard | null + ``` + + Each makes a single atomic CAS attempt — no waiting, no retry. Composes with `using` since `null` skips dispose registration: + + ```ts + using guard = mu.tryLock(); + if (!guard) return; // held elsewhere, nothing to dispose + // ...critical section; auto-unlock on scope exit + ``` + ## 1.2.2 ### Patch Changes diff --git a/package.json b/package.json index 1e8078e..68bae5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moroutine", - "version": "1.2.2", + "version": "1.3.0", "repository": { "type": "git", "url": "git@tangled.org:divy.zone/moroutine" -- 2.51.2