Skip to content
Browse files

style: Use an acquire load for is_unique in servo_arc.

Fixes #21186

Bug: 1476445
Reviewed-by: Manishearth
Differential Revision:
  • Loading branch information
bholley authored and emilio committed Jul 24, 2018
1 parent 498592f commit 89880727ece6be8515f32d3ad8f0f7e7b17216eb
Showing with 3 additions and 8 deletions.
  1. +3 −8 components/servo_arc/
@@ -349,15 +349,10 @@ impl<T: ?Sized> Arc<T> {

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]
self.inner().count.load(Acquire) == 1

0 comments on commit 8988072

Please sign in to comment.
You can’t perform that action at this time.