summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/TransactionalEvictorI.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-06-12 19:01:18 -0400
committerBernard Normier <bernard@zeroc.com>2007-06-12 19:01:18 -0400
commite097664d0d79d255ffe2c21e8185d1324ef43f96 (patch)
tree48465b67627f3c7383567421a56acbc27bf5f9d2 /cpp/src/Freeze/TransactionalEvictorI.cpp
parentBug 2222 - add note about MFC demos not compiling with 2005 Express (diff)
downloadice-e097664d0d79d255ffe2c21e8185d1324ef43f96.tar.bz2
ice-e097664d0d79d255ffe2c21e8185d1324ef43f96.tar.xz
ice-e097664d0d79d255ffe2c21e8185d1324ef43f96.zip
Fixed deadlock in Freeze transactional evictor
Diffstat (limited to 'cpp/src/Freeze/TransactionalEvictorI.cpp')
-rw-r--r--cpp/src/Freeze/TransactionalEvictorI.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp
index 278f37bc027..273eb4c6216 100644
--- a/cpp/src/Freeze/TransactionalEvictorI.cpp
+++ b/cpp/src/Freeze/TransactionalEvictorI.cpp
@@ -628,7 +628,7 @@ Freeze::TransactionalEvictorI::evict()
//
// Evict, no matter what!
//
- evict(*_evictorList.rbegin(), true);
+ evict(*_evictorList.rbegin());
}
}
@@ -667,45 +667,39 @@ Freeze::TransactionalEvictorI::loadCachedServant(const Identity& ident, ObjectSt
Ice::ObjectPtr
Freeze::TransactionalEvictorI::evict(const Identity& ident, ObjectStore<TransactionalEvictorElement>* store)
{
- Lock sync(*this);
- TransactionalEvictorElementPtr element = store->unpin(ident);
-
+ //
+ // Important: we can't wait for the DB (even indirectly) with 'this' locked
+ //
+ TransactionalEvictorElementPtr element = store->getIfPinned(ident, true);
+
if(element != 0)
{
- evict(element, false);
- return element->servant();
+ Lock sync(*this);
+ if(!element->_stale)
+ {
+ evict(element);
+ return element->servant();
+ }
}
return 0;
}
void
-Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& element, bool unpin)
+Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& element)
{
//
// Must be called with this locked!
//
assert(!element->_stale);
element->_stale = true;
-
- if(unpin)
- {
- element->_store.unpin(element->_cachePosition);
- }
-
+ element->_store.unpin(element->_cachePosition);
+
if(element->_inEvictor)
{
element->_inEvictor = false;
_evictorList.erase(element->_evictPosition);
_currentEvictorSize--;
}
- else
- {
- //
- // This object was removed before it had time to make it into
- // the evictor
- //
- assert(!unpin);
- }
}
void