mirror of
https://github.com/golang/go
synced 2024-11-23 00:10:07 -07:00
sync/atomic: fix race instrumentation
R=golang-dev, iant CC=golang-dev https://golang.org/cl/6782075
This commit is contained in:
parent
cc8bd8969f
commit
27087022ce
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user