From 907001bdd0f4e61c292ca113bd6f4b3ba836b13d Mon Sep 17 00:00:00 2001 From: Andrew Meredith Date: Mon, 4 Oct 2021 13:39:31 -0600 Subject: [PATCH] Update rc decrement snipped The atomic decrement to `rc` should be performed with an ordering of `Ordering::Release` rather than `ordering::Relaxed` to interact correctly with the fence. The code in the full `Drop` implementation at the bottom of the section is correct/ --- src/arc-mutex/arc-drop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arc-mutex/arc-drop.md b/src/arc-mutex/arc-drop.md index 4ed371fc..3dd9f03d 100644 --- a/src/arc-mutex/arc-drop.md +++ b/src/arc-mutex/arc-drop.md @@ -27,7 +27,7 @@ the last reference to the data). ```rust,ignore -if inner.rc.fetch_sub(1, Ordering::Relaxed) != 1 { +if inner.rc.fetch_sub(1, Ordering::Release) != 1 { return; } ```