]> Cypherpunks repositories - gostls13.git/commitdiff
sync/atomic: fix data race in tests
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 16 Jan 2012 07:43:36 +0000 (11:43 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 16 Jan 2012 07:43:36 +0000 (11:43 +0400)
Fixes #2710.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5541066

src/pkg/sync/atomic/atomic_test.go

index 02ee24b3556704a50df3a0d0a88fd78ed8ea207c..ad7557650f60895d95a2a7b79de6392e762cf18f 100644 (file)
@@ -1037,7 +1037,7 @@ func TestStoreLoadSeqCst32(t *testing.T) {
                                if my != i && his != i {
                                        t.Fatalf("store/load are not sequentially consistent: %d/%d (%d)", my, his, i)
                                }
-                               ack[me][(i-1)%3] = -1
+                               StoreInt32(&ack[me][(i-1)%3], -1)
                        }
                        c <- true
                }(p)
@@ -1078,7 +1078,7 @@ func TestStoreLoadSeqCst64(t *testing.T) {
                                if my != i && his != i {
                                        t.Fatalf("store/load are not sequentially consistent: %d/%d (%d)", my, his, i)
                                }
-                               ack[me][(i-1)%3] = -1
+                               StoreInt64(&ack[me][(i-1)%3], -1)
                        }
                        c <- true
                }(p)