github.com/m10x/go/src@v0.0.0-20220112094212-ba61592315da/runtime/internal/atomic/types_64bit.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm
     6  
     7  package atomic
     8  
     9  // LoadAcquire is a partially unsynchronized version
    10  // of Load that relaxes ordering constraints. Other threads
    11  // may observe operations that precede this operation to
    12  // occur after it, but no operation that occurs after it
    13  // on this thread can be observed to occur before it.
    14  //
    15  // WARNING: Use sparingly and with great care.
    16  func (u *Uint64) LoadAcquire() uint64 {
    17  	return LoadAcq64(&u.value)
    18  }
    19  
    20  // StoreRelease is a partially unsynchronized version
    21  // of Store that relaxes ordering constraints. Other threads
    22  // may observe operations that occur after this operation to
    23  // precede it, but no operation that precedes it
    24  // on this thread can be observed to occur after it.
    25  //
    26  // WARNING: Use sparingly and with great care.
    27  func (u *Uint64) StoreRelease(value uint64) {
    28  	StoreRel64(&u.value, value)
    29  }