1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
6 // The following code runs only on g0 stack.
12 func lfstackpush(head *uint64, node *lfnode) {
14 new := lfstackPack(node, node.pushcnt)
16 old := atomicload64(head)
18 if cas64(head, old, new) {
24 func lfstackpop(head *uint64) unsafe.Pointer {
26 old := atomicload64(head)
30 node, _ := lfstackUnpack(old)
31 next := atomicload64(&node.next)
32 if cas64(head, old, next) {
33 return unsafe.Pointer(node)