diff options
author | EuAndreh <eu@euandre.org> | 2025-05-22 13:09:35 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-05-22 13:09:35 -0300 |
commit | 70fe6f1cbb448b473eeda4d5ef7f3ac6630dd8d7 (patch) | |
tree | d9bbff162eef59317a01e1369736206e3c3d3ae1 /src/stm.go | |
parent | src/stm.go: Remove ad-hoc profiling code (diff) | |
download | stm-70fe6f1cbb448b473eeda4d5ef7f3ac6630dd8d7.tar.gz stm-70fe6f1cbb448b473eeda4d5ef7f3ac6630dd8d7.tar.xz |
src/stm.go: Rename Interface -> atomicI
Diffstat (limited to 'src/stm.go')
-rw-r--r-- | src/stm.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -102,7 +102,7 @@ import ( // the type. // Interface represents atomic operations on a value. -type Interface[T any] interface { +type atomicI[T any] interface{ // Load value atomically. Load() T // Store value atomically. @@ -113,7 +113,7 @@ type Interface[T any] interface { CompareAndSwap(old, new T) (swapped bool) } -var _ Interface[bool] = &Value[bool]{} +var _ atomicI[bool] = &Value[bool]{} // Value wraps any generic value in atomic load and store operations. // @@ -150,7 +150,7 @@ type atomicint interface { // Int expresses atomic operations on signed or unsigned integer values. type Int[T atomicint] interface { - Interface[T] + atomicI[T] // Add a value and return the new result. Add(delta T) (new T) } @@ -399,7 +399,7 @@ func VoidOperation(f func(*Tx)) Operation[struct{}] { } } -func Swap[T any](v *Var[T], f func(T) T) { +func Swap[T any](v *AtomT[T], f func(T) T) { Atomically(VoidOperation(func(tx *Tx) { v.Set(tx, f(v.Get(tx))) })) |