Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8db871d authored by Mathias Agopian's avatar Mathias Agopian
Browse files

double checked locking pattern is not safe on SMP

Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
parent 3aecbb07
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;
}