diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-11-05 03:39:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-11-05 03:39:49 +0000 |
commit | c9bc4e2d2bf5d5967754a16fd93af2c48c0f4533 (patch) | |
tree | 5b38402a4157cf86e5f193cc2014a007a7dbdf55 /libgo/go/sync | |
parent | 659e39f1bcb277ddcc701b9ed7d41776ab8b4214 (diff) | |
download | gcc-c9bc4e2d2bf5d5967754a16fd93af2c48c0f4533.zip gcc-c9bc4e2d2bf5d5967754a16fd93af2c48c0f4533.tar.gz gcc-c9bc4e2d2bf5d5967754a16fd93af2c48c0f4533.tar.bz2 |
sync/atomic: fix data races in tests
Backport https://codereview.appspot.com/111320044 from Go
master library.
From-SVN: r217110
Diffstat (limited to 'libgo/go/sync')
-rw-r--r-- | libgo/go/sync/atomic/atomic_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libgo/go/sync/atomic/atomic_test.go b/libgo/go/sync/atomic/atomic_test.go index d2af4f4..eaa3b6b 100644 --- a/libgo/go/sync/atomic/atomic_test.go +++ b/libgo/go/sync/atomic/atomic_test.go @@ -858,7 +858,7 @@ func hammerCompareAndSwapInt32(uaddr *uint32, count int) { addr := (*int32)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadInt32(addr) if CompareAndSwapInt32(addr, v, v+1) { break } @@ -869,7 +869,7 @@ func hammerCompareAndSwapInt32(uaddr *uint32, count int) { func hammerCompareAndSwapUint32(addr *uint32, count int) { for i := 0; i < count; i++ { for { - v := *addr + v := LoadUint32(addr) if CompareAndSwapUint32(addr, v, v+1) { break } @@ -883,7 +883,7 @@ func hammerCompareAndSwapUintptr32(uaddr *uint32, count int) { addr := (*uintptr)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadUintptr(addr) if CompareAndSwapUintptr(addr, v, v+1) { break } @@ -897,7 +897,7 @@ func hammerCompareAndSwapPointer32(uaddr *uint32, count int) { addr := (*unsafe.Pointer)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadPointer(addr) if CompareAndSwapPointer(addr, v, unsafe.Pointer(uintptr(v)+1)) { break } @@ -1039,7 +1039,7 @@ func hammerCompareAndSwapInt64(uaddr *uint64, count int) { addr := (*int64)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadInt64(addr) if CompareAndSwapInt64(addr, v, v+1) { break } @@ -1050,7 +1050,7 @@ func hammerCompareAndSwapInt64(uaddr *uint64, count int) { func hammerCompareAndSwapUint64(addr *uint64, count int) { for i := 0; i < count; i++ { for { - v := *addr + v := LoadUint64(addr) if CompareAndSwapUint64(addr, v, v+1) { break } @@ -1064,7 +1064,7 @@ func hammerCompareAndSwapUintptr64(uaddr *uint64, count int) { addr := (*uintptr)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadUintptr(addr) if CompareAndSwapUintptr(addr, v, v+1) { break } @@ -1078,7 +1078,7 @@ func hammerCompareAndSwapPointer64(uaddr *uint64, count int) { addr := (*unsafe.Pointer)(unsafe.Pointer(uaddr)) for i := 0; i < count; i++ { for { - v := *addr + v := LoadPointer(addr) if CompareAndSwapPointer(addr, v, unsafe.Pointer(uintptr(v)+1)) { break } |