diff options
| author | Vexu <git@vexu.eu> | 2020-03-12 22:42:01 +0200 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-03-12 22:42:01 +0200 |
| commit | 71d776c3be91f6b4e982b45fbfe03e3696a397f5 (patch) | |
| tree | de9487bd41b3c646f19018e03285730b15c6142d /lib/std/atomic/stack.zig | |
| parent | 6dde769279aaa0cc09d13dd0670b74a8dd24f547 (diff) | |
| download | zig-71d776c3be91f6b4e982b45fbfe03e3696a397f5.tar.gz zig-71d776c3be91f6b4e982b45fbfe03e3696a397f5.zip | |
add note to disabled tests, improve comptime cmpxchg
Diffstat (limited to 'lib/std/atomic/stack.zig')
| -rw-r--r-- | lib/std/atomic/stack.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/atomic/stack.zig b/lib/std/atomic/stack.zig index 07cb16e450..092dce15b0 100644 --- a/lib/std/atomic/stack.zig +++ b/lib/std/atomic/stack.zig @@ -38,8 +38,8 @@ pub fn Stack(comptime T: type) type { node.next = self.root; self.root = node; } else { - while (@atomicRmw(bool, &self.lock, .Xchg, true, .SeqCst) != false) {} - defer assert(@atomicRmw(bool, &self.lock, .Xchg, false, .SeqCst) == true); + while (@atomicRmw(bool, &self.lock, .Xchg, true, .SeqCst)) {} + defer assert(@atomicRmw(bool, &self.lock, .Xchg, false, .SeqCst)); node.next = self.root; self.root = node; @@ -52,8 +52,8 @@ pub fn Stack(comptime T: type) type { self.root = root.next; return root; } else { - while (@atomicRmw(bool, &self.lock, .Xchg, true, .SeqCst) != false) {} - defer assert(@atomicRmw(bool, &self.lock, .Xchg, false, .SeqCst) == true); + while (@atomicRmw(bool, &self.lock, .Xchg, true, .SeqCst)) {} + defer assert(@atomicRmw(bool, &self.lock, .Xchg, false, .SeqCst)); const root = self.root orelse return null; self.root = root.next; @@ -164,7 +164,7 @@ fn startPuts(ctx: *Context) u8 { fn startGets(ctx: *Context) u8 { while (true) { - const last = @atomicLoad(bool, &ctx.puts_done, .SeqCst) == true; + const last = @atomicLoad(bool, &ctx.puts_done, .SeqCst); while (ctx.stack.pop()) |node| { std.time.sleep(1); // let the os scheduler be our fuzz |
