double checked locking pattern is not safe on SMP
Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
This commit is contained in:
parent
3aecbb0715
commit
e8db871de7
@ -73,10 +73,11 @@ protected:
|
|||||||
|
|
||||||
sp<ProcessState> ProcessState::self()
|
sp<ProcessState> ProcessState::self()
|
||||||
{
|
{
|
||||||
if (gProcess != NULL) return gProcess;
|
Mutex::Autolock _l(gProcessMutex);
|
||||||
|
if (gProcess != NULL) {
|
||||||
AutoMutex _l(gProcessMutex);
|
return gProcess;
|
||||||
if (gProcess == NULL) gProcess = new ProcessState;
|
}
|
||||||
|
gProcess = new ProcessState;
|
||||||
return gProcess;
|
return gProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user