mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 939790 - make SafeMutex::mOwnerThread a relaxed atomic variable; r=bsmedberg
This is similar to the solution adopted for bug 1190985, a race in netwerk's DebugMutexAutoLock. A relaxed atomic tells tools like TSan that we're OK with this variable being touched from multiple threads. That it's only set from within a locked mutex should ensure whatever memory barriers we need are executed so all threads have a consistent view of what value it contains. Getting rid of another |volatile| usage in the codebase is just a bonus.
This commit is contained in:
parent
16d99d45bd
commit
fc3e60aac1
@ -15,6 +15,7 @@
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIFile.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Module.h"
|
||||
#include "mozilla/ModuleLoader.h"
|
||||
@ -124,7 +125,7 @@ public:
|
||||
|
||||
private:
|
||||
mozilla::Mutex mMutex;
|
||||
volatile PRThread* mOwnerThread;
|
||||
mozilla::Atomic<PRThread*, mozilla::Relaxed> mOwnerThread;
|
||||
};
|
||||
|
||||
typedef mozilla::BaseAutoLock<SafeMutex> SafeMutexAutoLock;
|
||||
|
Loading…
Reference in New Issue
Block a user