| 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 || loong64 || 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 |
// |
| 17 |
//go:nosplit |
| 18 |
func (u *Uint64) LoadAcquire() uint64 { |
| 19 |
return LoadAcq64(&u.value) |
| 20 |
} |
| 21 |
|
| 22 |
// StoreRelease is a partially unsynchronized version |
| 23 |
// of Store that relaxes ordering constraints. Other threads |
| 24 |
// may observe operations that occur after this operation to |
| 25 |
// precede it, but no operation that precedes it |
| 26 |
// on this thread can be observed to occur after it. |
| 27 |
// |
| 28 |
// WARNING: Use sparingly and with great care. |
| 29 |
// |
| 30 |
//go:nosplit |
| 31 |
func (u *Uint64) StoreRelease(value uint64) { |
| 32 |
StoreRel64(&u.value, value) |
| 33 |
} |