mirror of
https://github.com/golang/go
synced 2024-11-11 23:20:24 -07:00
sync/atomic: don't atomically write pointers twice
sync/atomic.StorePointer (which is implemented in runtime/atomic_pointer.go) writes the pointer twice (through two completely different code paths, no less). Fix it to only write once. Change-Id: Id3b2aef9aa9081c2cf096833e001b93d3dd1f5da Reviewed-on: https://go-review.googlesource.com/21999 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
8f6c35de2f
commit
7c7081f514
@ -44,7 +44,6 @@ func sync_atomic_StoreUintptr(ptr *uintptr, new uintptr)
|
||||
//go:nosplit
|
||||
func sync_atomic_StorePointer(ptr *unsafe.Pointer, new unsafe.Pointer) {
|
||||
sync_atomic_StoreUintptr((*uintptr)(unsafe.Pointer(ptr)), uintptr(new))
|
||||
atomic.StorepNoWB(noescape(unsafe.Pointer(ptr)), new)
|
||||
writebarrierptr_nostore((*uintptr)(unsafe.Pointer(ptr)), uintptr(new))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user