libprocessgroup: Deliberately leak TaskProfiles and CgroupMap instances.
This avoids a race between destruction on process exit and concurrent access from another thread. Bug: 129023204 Change-Id: Iecafa67a78e2cce53687156e7f91547b4a23ec13
This commit is contained in:
parent
c3e96512c0
commit
dba6d44376
|
@ -336,8 +336,10 @@ CgroupMap::~CgroupMap() {
|
|||
}
|
||||
|
||||
CgroupMap& CgroupMap::GetInstance() {
|
||||
static CgroupMap instance;
|
||||
return instance;
|
||||
// Deliberately leak this object to avoid a race between destruction on
|
||||
// process exit and concurrent access from another thread.
|
||||
static auto* instance = new CgroupMap;
|
||||
return *instance;
|
||||
}
|
||||
|
||||
bool CgroupMap::LoadRcFile() {
|
||||
|
|
|
@ -284,8 +284,10 @@ bool TaskProfile::ExecuteForTask(int tid) const {
|
|||
}
|
||||
|
||||
TaskProfiles& TaskProfiles::GetInstance() {
|
||||
static TaskProfiles instance;
|
||||
return instance;
|
||||
// Deliberately leak this object to avoid a race between destruction on
|
||||
// process exit and concurrent access from another thread.
|
||||
static auto* instance = new TaskProfiles;
|
||||
return *instance;
|
||||
}
|
||||
|
||||
TaskProfiles::TaskProfiles() {
|
||||
|
|
Loading…
Reference in New Issue