mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1630655 - Squash TSAN data race report in IOInterposer r=aklotz
In practice this shouldn't substantially change the behavior, but it gets around being UB, and it shouldn't really cost us in terms of performance. The alternative would be adding it to the TSAN whitelist, which feels worse. Differential Revision: https://phabricator.services.mozilla.com/D72015
This commit is contained in:
parent
686c7cce17
commit
dfa7ab6aeb
@ -290,11 +290,10 @@ class MasterList {
|
||||
}
|
||||
|
||||
inline bool IsObservedOperation(mozilla::IOInterposeObserver::Operation aOp) {
|
||||
// The quick reader may observe that no locks are being employed here,
|
||||
// hence the result of the operations is truly undefined. However, most
|
||||
// computers will usually return either true or false, which is good enough.
|
||||
// It is not a problem if we occasionally report more or less IO than is
|
||||
// actually occurring.
|
||||
// This does not occur inside of a lock, so this makes no guarantees that
|
||||
// the observers are in sync with this. That is acceptable; it is not a
|
||||
// problem if we occasionally report more or less IO than is actually
|
||||
// occurring.
|
||||
return mIsEnabled && !!(mObservedOperations & aOp);
|
||||
}
|
||||
|
||||
@ -307,7 +306,9 @@ class MasterList {
|
||||
// during shutdown.
|
||||
mozilla::IOInterposer::Mutex mLock;
|
||||
// Flags tracking which operations are being observed
|
||||
mozilla::IOInterposeObserver::Operation mObservedOperations;
|
||||
mozilla::Atomic<mozilla::IOInterposeObserver::Operation,
|
||||
mozilla::MemoryOrdering::Relaxed>
|
||||
mObservedOperations;
|
||||
// Used for quickly disabling everything by IOInterposer::Disable()
|
||||
mozilla::Atomic<bool> mIsEnabled;
|
||||
// Used to inform threads that the master observer list has changed
|
||||
|
Loading…
Reference in New Issue
Block a user