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 4a20fff9d..a4ad8a10c 100644 --- a/src/runtime/lfstack.go +++ b/src/runtime/lfstack.go @@ -14,7 +14,7 @@ func lfstackpush(head *uint64, node *lfnode) { new := lfstackPack(node, node.pushcnt) for { old := atomicload64(head) - node.next, _ = lfstackUnpack(old) + node.next = old if cas64(head, old, new) { break } @@ -28,12 +28,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) } } |