diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-05-04 13:39:27 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-05-04 13:39:27 -0400 |
| commit | 7e37d268c86ccc823c4a381a42029722d36c3975 (patch) | |
| tree | 1600a184f03fedd91131bcbaea2c5ee85dfa06a3 /std/atomic/stack.zig | |
| parent | 6309121f70ff88cf64267f2bf1d9e452090ca277 (diff) | |
| parent | ef3111be236fc389a696562d31bccd3a9b6d1c56 (diff) | |
| download | zig-7e37d268c86ccc823c4a381a42029722d36c3975.tar.gz zig-7e37d268c86ccc823c4a381a42029722d36c3975.zip | |
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'std/atomic/stack.zig')
| -rw-r--r-- | std/atomic/stack.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig index accbcc942a..4a3dbef32b 100644 --- a/std/atomic/stack.zig +++ b/std/atomic/stack.zig @@ -35,7 +35,7 @@ pub fn Stack(comptime T: type) type { } pub fn pop(self: &Self) ?&Node { - var root = @atomicLoad(?&Node, &self.root, AtomicOrder.Acquire); + var root = @atomicLoad(?&Node, &self.root, AtomicOrder.SeqCst); while (true) { root = @cmpxchgWeak(?&Node, &self.root, root, (root ?? return null).next, AtomicOrder.SeqCst, AtomicOrder.SeqCst) ?? return root; } @@ -56,14 +56,19 @@ const Context = struct { get_count: usize, puts_done: u8, // TODO make this a bool }; -const puts_per_thread = 1000; +// TODO add lazy evaluated build options and then put puts_per_thread behind +// some option such as: "AggressiveMultithreadedFuzzTest". In the AppVeyor +// CI we would use a less aggressive setting since at 1 core, while we still +// want this test to pass, we need a smaller value since there is so much thrashing +// we would also use a less aggressive setting when running in valgrind +const puts_per_thread = 500; const put_thread_count = 3; test "std.atomic.stack" { var direct_allocator = std.heap.DirectAllocator.init(); defer direct_allocator.deinit(); - var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 64 * 1024 * 1024); + var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 300 * 1024); defer direct_allocator.allocator.free(plenty_of_memory); var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory); |
