atomic icon indicating copy to clipboard operation
atomic copied to clipboard

Use standard lib's atomicint in go1.19+

Open wwqgtxx opened this issue 3 years ago • 2 comments

only the standard lib's sync/atomic has

// align64 may be added to structs that must be 64-bit aligned.
// This struct is recognized by a special case in the compiler
// and will not work if copied to any other package.
type align64 struct{}

which can ensure 64-bit aligned

the v1.10.0 version of uber-go/atomic when cause panic in mips with golang1.20

panic: unaligned 64-bit atomic operation

goroutine 136 [running]:
runtime/internal/atomic.panicUnaligned(...)
 runtime/internal/atomic/unaligned.go:8
runtime/internal/atomic.lockAndCheck(...)
 runtime/internal/atomic/atomic_mipsx.go:38
runtime/internal/atomic.Load64(0x2533bd4)
 runtime/internal/atomic/atomic_mipsx.go:94 +0xa8
go.uber.org/atomic.(*Int64).Load(...)
 go.uber.org/[email protected]/int64.go:45

wwqgtxx avatar Feb 02 '23 13:02 wwqgtxx

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 02 '23 13:02 CLAassistant

Codecov Report

Attention: Patch coverage is 0% with 43 lines in your changes are missing coverage. Please review.

Project coverage is 83.89%. Comparing base (78a3b8e) to head (0e55a85). Report is 17 commits behind head on master.

Files Patch % Lines
internal/gen-atomicint-go119/main.go 0.00% 43 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##            master     #127       +/-   ##
============================================
- Coverage   100.00%   83.89%   -16.11%     
============================================
  Files           23       23               
  Lines          232      267       +35     
============================================
- Hits           232      224        -8     
- Misses           0       43       +43     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 02 '23 17:02 codecov[bot]