Using Release
in the store
operation for make_mut
just prevent out-of-thin-air value?
#133284
Labels
A-atomic
Area: Atomics, barriers, and sync primitives
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
In https://doc.rust-lang.org/src/alloc/sync.rs.html#2267, the
make_mut
is implemented aswhile
upgrade
isThe
Release
at#1
concerns this caseIn this case,
upgrade
will returnSome
if it reads#1
and#1
is executed only#0
reads the value written byweak.fetch_sub(1, Release)
indrop(weak);
, so the model can be simplified as#1 read #4, #4 is executed only if
#3
read#2
,#2
is executed only if#1
read#4
. It depends on the out-of-thin-air value. Do we need arelease
memory order here to prevent OOTD?The text was updated successfully, but these errors were encountered: