object: fix race detected by tsan in mpsc queue
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
40dcef1836
commit
4bcafe89c4
1 changed files with 9 additions and 0 deletions
|
|
@ -350,6 +350,15 @@ pub fn Queue(comptime Value: type) type {
|
||||||
// Lost race (with another takeAll() or pop()), retry from start
|
// Lost race (with another takeAll() or pop()), retry from start
|
||||||
continue :outer;
|
continue :outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure all previous atomic operations (including linking) are complete
|
||||||
|
// Specifically this part of pushRaw():
|
||||||
|
//
|
||||||
|
// // Link previous node to new node
|
||||||
|
// @atomicStore(?*Node, &prev.next, node, .release);
|
||||||
|
//
|
||||||
|
_ = @atomicLoad(*Node, &q.head, .acquire);
|
||||||
|
|
||||||
return tail;
|
return tail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue