mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Prevent race conditions when getting elements for the first time or
after flushing the cache (cherry picked from commit b99066f4e11f9b698ef376d751826b8288f502f6) (cherry picked from commit e50033d1732f9b5c1a56eacaf1edce9cc0d7471e)
This commit is contained in:
parent
01f7846904
commit
cd41617e2d
@ -41,18 +41,12 @@ void PoolSQLCache::lock_line(int oid)
|
||||
{
|
||||
cl = new CacheLine(0);
|
||||
|
||||
cl->active++;
|
||||
|
||||
cache.insert(make_pair(oid, cl));
|
||||
|
||||
unlock();
|
||||
|
||||
cl->lock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
cl = it->second;
|
||||
else
|
||||
{
|
||||
cl = it->second;
|
||||
}
|
||||
|
||||
cl->active++;
|
||||
|
||||
@ -65,9 +59,9 @@ void PoolSQLCache::lock_line(int oid)
|
||||
cl->object->lock();
|
||||
|
||||
delete cl->object;
|
||||
}
|
||||
|
||||
cl->object = 0;
|
||||
cl->object = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user