diff options
Diffstat (limited to 'src/runtime/stubs.go')
| -rw-r--r-- | src/runtime/stubs.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index f116dc3e9f..cd9a22336f 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -167,6 +167,23 @@ func xaddint64(ptr *int64, delta int64) int64 { return int64(xadd64((*uint64)(unsafe.Pointer(ptr)), delta)) } +// publicationBarrier performs a store/store barrier (a "publication" +// or "export" barrier). Some form of synchronization is required +// between initializing an object and making that object accessible to +// another processor. Without synchronization, the initialization +// writes and the "publication" write may be reordered, allowing the +// other processor to follow the pointer and observe an uninitialized +// object. In general, higher-level synchronization should be used, +// such as locking or an atomic pointer write. publicationBarrier is +// for when those aren't an option, such as in the implementation of +// the memory manager. +// +// There's no corresponding barrier for the read side because the read +// side naturally has a data dependency order. All architectures that +// Go supports or seems likely to ever support automatically enforce +// data dependency ordering. +func publicationBarrier() + //go:noescape func setcallerpc(argp unsafe.Pointer, pc uintptr) |
