aboutsummaryrefslogtreecommitdiff
path: root/std/atomic/stack.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-20 17:33:49 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-20 17:33:49 -0400
commit4eca75c53b4679e7e31df1505d22a5b618a2d797 (patch)
tree1682c01aac310e445a68830545f670d121ac38ea /std/atomic/stack.zig
parent55193cb13bbc69350474f6a66728319b41149274 (diff)
parent85f928f8bff8c033f6ef0104d68b033669cb36e4 (diff)
downloadzig-4eca75c53b4679e7e31df1505d22a5b618a2d797.tar.gz
zig-4eca75c53b4679e7e31df1505d22a5b618a2d797.zip
Merge branch 'kristate-stdmem-replace-create-with-construct'
Diffstat (limited to 'std/atomic/stack.zig')
-rw-r--r--std/atomic/stack.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig
index 9e81d89257..d74bee8e8b 100644
--- a/std/atomic/stack.zig
+++ b/std/atomic/stack.zig
@@ -117,8 +117,10 @@ fn startPuts(ctx: *Context) u8 {
while (put_count != 0) : (put_count -= 1) {
std.os.time.sleep(0, 1); // let the os scheduler be our fuzz
const x = @bitCast(i32, r.random.scalar(u32));
- const node = ctx.allocator.create(Stack(i32).Node) catch unreachable;
- node.data = x;
+ const node = ctx.allocator.create(Stack(i32).Node{
+ .next = undefined,
+ .data = x,
+ }) catch unreachable;
ctx.stack.push(node);
_ = @atomicRmw(isize, &ctx.put_sum, builtin.AtomicRmwOp.Add, x, AtomicOrder.SeqCst);
}