diff options
Diffstat (limited to 'src')
-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))) })) |