Merge "double checked locking pattern is not safe on SMP"

This commit is contained in:
Mathias Agopian 2012-04-17 14:22:45 -07:00 committed by Android (Google) Code Review
commit fe668f4682

View File

@ -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;
}