github.com/aykevl/tinygo@v0.5.0/src/runtime/atomic.go (about) 1 package runtime 2 3 // This file contains implementations for the sync/atomic package. 4 5 // All implementations assume there are no goroutines, threads or interrupts. 6 7 //go:linkname loadUint64 sync/atomic.LoadUint64 8 func loadUint64(addr *uint64) uint64 { 9 return *addr 10 } 11 12 //go:linkname storeUint32 sync/atomic.StoreUint32 13 func storeUint32(addr *uint32, val uint32) { 14 *addr = val 15 } 16 17 //go:linkname compareAndSwapUint64 sync/atomic.CompareAndSwapUint64 18 func compareAndSwapUint64(addr *uint64, old, new uint64) bool { 19 if *addr == old { 20 *addr = new 21 return true 22 } 23 return false 24 }