From 35df7f259b6300abd052f166b38100947c50fece Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 4 Nov 2019 18:45:41 +1100 Subject: Fix TestDecrement With only a single cpu it would spin endlessly without a synchronization point (since changing AtomicGet to use atomics). --- stm_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stm_test.go b/stm_test.go index 527e480..28f56ec 100644 --- a/stm_test.go +++ b/stm_test.go @@ -15,12 +15,10 @@ func TestDecrement(t *testing.T) { } done := make(chan struct{}) go func() { - for { - if AtomicGet(x).(int) == 500 { - break - } - } - done <- struct{}{} + Atomically(func(tx *Tx) { + tx.Assert(tx.Get(x) == 500) + }) + close(done) }() select { case <-done: -- cgit v1.2.3