1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:54:39 -07:00

sync/atomic: fix race instrumentation

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6782075
This commit is contained in:
Dmitriy Vyukov 2012-11-15 21:30:24 +04:00
parent cc8bd8969f
commit 27087022ce

View File

@ -165,7 +165,7 @@ func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) {
func LoadUintptr(addr *uintptr) (val uintptr) {
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceRead(unsafe.Pointer(addr))
runtime.RaceAcquire(unsafe.Pointer(addr))
val = *addr
runtime.RaceSemrelease(&mtx)
@ -198,7 +198,7 @@ func StoreUint64(addr *uint64, val uint64) {
func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) {
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
runtime.RaceRelease(unsafe.Pointer(addr))
runtime.RaceSemrelease(&mtx)
@ -206,7 +206,7 @@ func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) {
func StoreUintptr(addr *uintptr, val uintptr) {
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
runtime.RaceRelease(unsafe.Pointer(addr))
runtime.RaceSemrelease(&mtx)