aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo_arc
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2018-07-17 22:23:26 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-07-24 03:27:08 +0200
commit89880727ece6be8515f32d3ad8f0f7e7b17216eb (patch)
tree08a92b9c68e18f56e78dfe72c96769597a609b7d /components/servo_arc
parent498592ff614fc7d74f32abe7ff28ce74ff926a3b (diff)
downloadservo-89880727ece6be8515f32d3ad8f0f7e7b17216eb.tar.gz
servo-89880727ece6be8515f32d3ad8f0f7e7b17216eb.zip
style: Use an acquire load for is_unique in servo_arc.
Fixes #21186 Bug: 1476445 Reviewed-by: Manishearth Differential Revision: https://phabricator.services.mozilla.com/D2205
Diffstat (limited to 'components/servo_arc')
-rw-r--r--components/servo_arc/lib.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs
index e2063c79a9c..3e6cd65e85d 100644
--- a/components/servo_arc/lib.rs
+++ b/components/servo_arc/lib.rs
@@ -349,15 +349,10 @@ impl<T: ?Sized> Arc<T> {
#[inline]
pub fn is_unique(&self) -> bool {
- // We can use Relaxed here, but the justification is a bit subtle.
+ // See the extensive discussion in [1] for why this needs to be Acquire.
//
- // The reason to use Acquire would be to synchronize with other threads
- // that are modifying the refcount with Release, i.e. to ensure that
- // their writes to memory guarded by this refcount are flushed. However,
- // we know that threads only modify the contents of the Arc when they
- // observe the refcount to be 1, and no other thread could observe that
- // because we're holding one strong reference here.
- self.inner().count.load(Relaxed) == 1
+ // [1] https://github.com/servo/servo/issues/21186
+ self.inner().count.load(Acquire) == 1
}
}