aboutsummaryrefslogtreecommitdiff
path: root/std/atomic/stack.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/atomic/stack.zig')
-rw-r--r--std/atomic/stack.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig
index 4a3dbef32b..400a1a3c4f 100644
--- a/std/atomic/stack.zig
+++ b/std/atomic/stack.zig
@@ -14,9 +14,7 @@ pub fn Stack(comptime T: type) type {
};
pub fn init() Self {
- return Self {
- .root = null,
- };
+ return Self{ .root = null };
}
/// push operation, but only if you are the first item in the stack. if you did not succeed in
@@ -75,7 +73,7 @@ test "std.atomic.stack" {
var a = &fixed_buffer_allocator.allocator;
var stack = Stack(i32).init();
- var context = Context {
+ var context = Context{
.allocator = a,
.stack = &stack,
.put_sum = 0,
@@ -86,16 +84,18 @@ test "std.atomic.stack" {
var putters: [put_thread_count]&std.os.Thread = undefined;
for (putters) |*t| {
- *t = try std.os.spawnThread(&context, startPuts);
+ t.* = try std.os.spawnThread(&context, startPuts);
}
var getters: [put_thread_count]&std.os.Thread = undefined;
for (getters) |*t| {
- *t = try std.os.spawnThread(&context, startGets);
+ t.* = try std.os.spawnThread(&context, startGets);
}
- for (putters) |t| t.wait();
+ for (putters) |t|
+ t.wait();
_ = @atomicRmw(u8, &context.puts_done, builtin.AtomicRmwOp.Xchg, 1, AtomicOrder.SeqCst);
- for (getters) |t| t.wait();
+ for (getters) |t|
+ t.wait();
std.debug.assert(context.put_sum == context.get_sum);
std.debug.assert(context.get_count == puts_per_thread * put_thread_count);