From 70fe6f1cbb448b473eeda4d5ef7f3ac6630dd8d7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 22 May 2025 13:09:35 -0300 Subject: src/stm.go: Rename Interface -> atomicI --- src/stm.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/stm.go') diff --git a/src/stm.go b/src/stm.go index 41359af..6aa6fae 100644 --- a/src/stm.go +++ b/src/stm.go @@ -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))) })) -- cgit v1.2.3