diff options
author | Mathias Agopian <mathias@google.com> | 2012-04-16 19:30:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-04-16 19:30:56 -0700 |
commit | e8db871de7b26bf4fe7ae8d400c4a2c503cfe3a2 (patch) | |
tree | 671257f4c9889723f876463d8c22e1c63b7d106a /libs/binder | |
parent | 3aecbb0715cb6928e0530ff1e4caa9c0993cc371 (diff) | |
download | frameworks_native-e8db871de7b26bf4fe7ae8d400c4a2c503cfe3a2.zip frameworks_native-e8db871de7b26bf4fe7ae8d400c4a2c503cfe3a2.tar.gz frameworks_native-e8db871de7b26bf4fe7ae8d400c4a2c503cfe3a2.tar.bz2 |
double checked locking pattern is not safe on SMP
Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/ProcessState.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 9fa412c..5399e52 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -73,10 +73,11 @@ protected: sp<ProcessState> ProcessState::self() { - if (gProcess != NULL) return gProcess; - - AutoMutex _l(gProcessMutex); - if (gProcess == NULL) gProcess = new ProcessState; + Mutex::Autolock _l(gProcessMutex); + if (gProcess != NULL) { + return gProcess; + } + gProcess = new ProcessState; return gProcess; } |