aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/lfstack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/lfstack.c')
-rw-r--r--src/pkg/runtime/lfstack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/lfstack.c b/src/pkg/runtime/lfstack.c
index 1d48491aac..140384d3dc 100644
--- a/src/pkg/runtime/lfstack.c
+++ b/src/pkg/runtime/lfstack.c
@@ -29,10 +29,10 @@ runtime·lfstackpush(uint64 *head, LFNode *node)
node->pushcnt++;
new = (uint64)(uintptr)node|(((uint64)node->pushcnt&CNT_MASK)<<PTR_BITS);
- old = runtime·atomicload64(head);
for(;;) {
+ old = runtime·atomicload64(head);
node->next = (LFNode*)(uintptr)(old&PTR_MASK);
- if(runtime·cas64(head, &old, new))
+ if(runtime·cas64(head, old, new))
break;
}
}
@@ -43,8 +43,8 @@ runtime·lfstackpop(uint64 *head)
LFNode *node, *node2;
uint64 old, new;
- old = runtime·atomicload64(head);
for(;;) {
+ old = runtime·atomicload64(head);
if(old == 0)
return nil;
node = (LFNode*)(uintptr)(old&PTR_MASK);
@@ -52,7 +52,7 @@ runtime·lfstackpop(uint64 *head)
new = 0;
if(node2 != nil)
new = (uint64)(uintptr)node2|(((uint64)node2->pushcnt&CNT_MASK)<<PTR_BITS);
- if(runtime·cas64(head, &old, new))
+ if(runtime·cas64(head, old, new))
return node;
}
}