diff options
Diffstat (limited to 'src/runtime/lfstack.go')
| -rw-r--r-- | src/runtime/lfstack.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/runtime/lfstack.go b/src/runtime/lfstack.go index 5838c1d14d..de3999a5fb 100644 --- a/src/runtime/lfstack.go +++ b/src/runtime/lfstack.go @@ -7,7 +7,10 @@ package runtime -import "unsafe" +import ( + "runtime/internal/atomic" + "unsafe" +) func lfstackpush(head *uint64, node *lfnode) { node.pushcnt++ @@ -17,9 +20,9 @@ func lfstackpush(head *uint64, node *lfnode) { throw("lfstackpush") } for { - old := atomicload64(head) + old := atomic.Load64(head) node.next = old - if cas64(head, old, new) { + if atomic.Cas64(head, old, new) { break } } @@ -27,13 +30,13 @@ func lfstackpush(head *uint64, node *lfnode) { func lfstackpop(head *uint64) unsafe.Pointer { for { - old := atomicload64(head) + old := atomic.Load64(head) if old == 0 { return nil } node, _ := lfstackUnpack(old) - next := atomicload64(&node.next) - if cas64(head, old, next) { + next := atomic.Load64(&node.next) + if atomic.Cas64(head, old, next) { return unsafe.Pointer(node) } } |
