| author | |
| committer | |
| log | fc87f6e417d206a88b581b77d3a5494ae4c978dd |
| tree | 63cdc891c10a1a00fa0d554e59fbf095848b3069 |
| parent | e1f56c9af6fd9ab495e0c499e2c545e7d048fa9e |
2 files changed, 6 insertions(+), 8 deletions(-)
std/atomic/queue.zig+3-4| ... | @@ -124,15 +124,14 @@ fn startPuts(ctx: *Context) u8 { | ... | @@ -124,15 +124,14 @@ fn startPuts(ctx: *Context) u8 { |
| 124 | 124 | ||
| 125 | fn startGets(ctx: *Context) u8 { | 125 | fn startGets(ctx: *Context) u8 { |
| 126 | while (true) { | 126 | while (true) { |
| 127 | const last = @atomicLoad(u8, &ctx.puts_done, builtin.AtomicOrder.SeqCst) == 1; | ||
| 128 | |||
| 127 | while (ctx.queue.get()) |node| { | 129 | while (ctx.queue.get()) |node| { |
| 128 | std.os.time.sleep(0, 1); // let the os scheduler be our fuzz | 130 | std.os.time.sleep(0, 1); // let the os scheduler be our fuzz |
| 129 | _ = @atomicRmw(isize, &ctx.get_sum, builtin.AtomicRmwOp.Add, node.data, builtin.AtomicOrder.SeqCst); | 131 | _ = @atomicRmw(isize, &ctx.get_sum, builtin.AtomicRmwOp.Add, node.data, builtin.AtomicOrder.SeqCst); |
| 130 | _ = @atomicRmw(usize, &ctx.get_count, builtin.AtomicRmwOp.Add, 1, builtin.AtomicOrder.SeqCst); | 132 | _ = @atomicRmw(usize, &ctx.get_count, builtin.AtomicRmwOp.Add, 1, builtin.AtomicOrder.SeqCst); |
| 131 | } | 133 | } |
| 132 | 134 | ||
| 133 | if (@atomicLoad(u8, &ctx.puts_done, builtin.AtomicOrder.SeqCst) == 1) { | 135 | if (last) return 0; |
| 134 | break; | ||
| 135 | } | ||
| 136 | } | 136 | } |
| 137 | return 0; | ||
| 138 | } | 137 | } |
std/atomic/stack.zig+3-4| ... | @@ -127,15 +127,14 @@ fn startPuts(ctx: *Context) u8 { | ... | @@ -127,15 +127,14 @@ fn startPuts(ctx: *Context) u8 { |
| 127 | 127 | ||
| 128 | fn startGets(ctx: *Context) u8 { | 128 | fn startGets(ctx: *Context) u8 { |
| 129 | while (true) { | 129 | while (true) { |
| 130 | const last = @atomicLoad(u8, &ctx.puts_done, builtin.AtomicOrder.SeqCst) == 1; | ||
| 131 | |||
| 130 | while (ctx.stack.pop()) |node| { | 132 | while (ctx.stack.pop()) |node| { |
| 131 | std.os.time.sleep(0, 1); // let the os scheduler be our fuzz | 133 | std.os.time.sleep(0, 1); // let the os scheduler be our fuzz |
| 132 | _ = @atomicRmw(isize, &ctx.get_sum, builtin.AtomicRmwOp.Add, node.data, builtin.AtomicOrder.SeqCst); | 134 | _ = @atomicRmw(isize, &ctx.get_sum, builtin.AtomicRmwOp.Add, node.data, builtin.AtomicOrder.SeqCst); |
| 133 | _ = @atomicRmw(usize, &ctx.get_count, builtin.AtomicRmwOp.Add, 1, builtin.AtomicOrder.SeqCst); | 135 | _ = @atomicRmw(usize, &ctx.get_count, builtin.AtomicRmwOp.Add, 1, builtin.AtomicOrder.SeqCst); |
| 134 | } | 136 | } |
| 135 | 137 | ||
| 136 | if (@atomicLoad(u8, &ctx.puts_done, builtin.AtomicOrder.SeqCst) == 1) { | 138 | if (last) return 0; |
| 137 | break; | ||
| 138 | } | ||
| 139 | } | 139 | } |
| 140 | return 0; | ||
| 141 | } | 140 | } |