diff options
author | Marc Laukien <marc@zeroc.com> | 2005-11-08 00:01:13 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2005-11-08 00:01:13 +0000 |
commit | 65b74644be770fa3c67f0260fe50462d1e3aa202 (patch) | |
tree | d0d8479b2d45726d7a2b70cfbf8b21c008ab07f2 /cpp/src | |
parent | Changes to allow test suite to run with compressionn on but not available (diff) | |
download | ice-65b74644be770fa3c67f0260fe50462d1e3aa202.tar.bz2 ice-65b74644be770fa3c67f0260fe50462d1e3aa202.tar.xz ice-65b74644be770fa3c67f0260fe50462d1e3aa202.zip |
fixed bi-dir/shutdown deadlock
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 38d6cac7992..dc50521f6cb 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1152,41 +1152,21 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter) assert(_state < StateClosing); - // - // Before we set an adapter (or reset it) we wait until the - // dispatch count with any old adapter is zero. - // - // A deadlock can occur if we wait while an operation is - // outstanding on this adapter that holds a lock while calling - // this function (e.g., __getDelegate). - // - // In order to avoid such a deadlock, we only wait if the new - // adapter is different than the current one. - // - // TODO: Verify that this fix solves all cases. - // - if(_adapter.get() != adapter.get()) - { - while(_dispatchCount > 0) - { - wait(); - } + _adapter = adapter; - // - // We never change the thread pool with which we were - // initially registered, even if we add or remove an object - // adapter. - // - _adapter = adapter; - if(_adapter) - { - _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager(); - } - else - { - _servantManager = 0; - } + if(_adapter) + { + _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager(); } + else + { + _servantManager = 0; + } + + // + // We never change the thread pool with which we were initially + // registered, even if we add or remove an object adapter. + // } ObjectAdapterPtr |