mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 05:04:56 +09:00
Prevent race conditions when getting elements for the first time or
after flushing the cache
This commit is contained in:
1 parent
10f014db10
commit
b99066f4e1
1 file changed
+6
-12
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user