mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1600312 - Use atomic load instead of fence for RefCounted with TSan. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D55948 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
85117004f2
commit
1636d4ab1f
@ -131,7 +131,14 @@ class RC<T, AtomicRefCount, Recording> {
|
||||
// acquire semantics to synchronize with the memory released by
|
||||
// the last release on other threads, that is, to ensure that
|
||||
// writes prior to that release are now visible on this thread.
|
||||
#ifdef MOZ_TSAN
|
||||
// TSan doesn't understand std::atomic_thread_fence, so in order
|
||||
// to avoid a false positive for every time a refcounted object
|
||||
// is deleted, we replace the fence with an atomic operation.
|
||||
mValue.load(std::memory_order_acquire);
|
||||
#else
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user