Skip to content
Snippets Groups Projects
Commit e5e24f08 authored by Vadzim Dambrouski's avatar Vadzim Dambrouski
Browse files

What if tsan is right?

parent a885d6a4
No related branches found
No related tags found
No related merge requests found
......@@ -88,8 +88,8 @@ where
let n = rb.capacity() + 1;
let buffer: &mut [T] = unsafe { rb.buffer.as_mut() };
let head = rb.head.load_relaxed();
let tail = rb.tail.load_relaxed();
let head = rb.head.load_acquire();
let next_tail = (tail + 1) % n;
if next_tail != head {
// NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We
......
......@@ -87,7 +87,7 @@ fn contention() {
scope.execute(move || {
let mut sum: u32 = 0;
for i in 0..N {
for i in 0..(2*N) {
let i = i as u8;
sum = sum.wrapping_add(i as u32);
while let Err(_) = p.enqueue(i) {}
......@@ -99,7 +99,7 @@ fn contention() {
scope.execute(move || {
let mut sum: u32 = 0;
for _ in 0..N {
for _ in 0..(2*N) {
loop {
match c.dequeue() {
Some(v) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment