diff options
Diffstat (limited to 'src/runtime/lfstack.go')
-rw-r--r-- | src/runtime/lfstack.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/runtime/lfstack.go b/src/runtime/lfstack.go index 8a36a67b3..fd3325972 100644 --- a/src/runtime/lfstack.go +++ b/src/runtime/lfstack.go @@ -18,7 +18,7 @@ func lfstackpush(head *uint64, node *lfnode) { } for { old := atomicload64(head) - node.next, _ = lfstackUnpack(old) + node.next = old if cas64(head, old, new) { break } @@ -32,12 +32,8 @@ func lfstackpop(head *uint64) unsafe.Pointer { return nil } node, _ := lfstackUnpack(old) - node2 := (*lfnode)(atomicloadp(unsafe.Pointer(&node.next))) - new := uint64(0) - if node2 != nil { - new = lfstackPack(node2, node2.pushcnt) - } - if cas64(head, old, new) { + next := atomicload64(&node.next) + if cas64(head, old, next) { return unsafe.Pointer(node) } } |