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 ++++---- tests/benchmarks/interface-store/stm.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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))) })) diff --git a/tests/benchmarks/interface-store/stm.go b/tests/benchmarks/interface-store/stm.go index 8e9a36b..167f448 100644 --- a/tests/benchmarks/interface-store/stm.go +++ b/tests/benchmarks/interface-store/stm.go @@ -17,7 +17,7 @@ func MainTest() { flag.Parse() n := *nFlag - var v Interface[string] = New("hello") + var v atomicI[string] = New("hello") for i := 0; i < n; i++ { v.Store(fmt.Sprint(i)) } -- cgit v1.2.3