diff options
author | Marc Laukien <marc@zeroc.com> | 2004-11-23 16:27:29 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-11-23 16:27:29 +0000 |
commit | df36c6bcc684e681cd424ee93a8f5ece8dfd9068 (patch) | |
tree | 972a3d2a5792aa478872bb43044b0a8c804308dd /cpp/src/Ice/ConnectionI.cpp | |
parent | fix (diff) | |
download | ice-df36c6bcc684e681cd424ee93a8f5ece8dfd9068.tar.bz2 ice-df36c6bcc684e681cd424ee93a8f5ece8dfd9068.tar.xz ice-df36c6bcc684e681cd424ee93a8f5ece8dfd9068.zip |
made isFinished more robust
Diffstat (limited to 'cpp/src/Ice/ConnectionI.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 492bb72c398..2e2c99c6c9d 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -222,7 +222,13 @@ Ice::ConnectionI::close(bool force) bool Ice::ConnectionI::isDestroyed() const { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this); + + if(!sync.acquired()) + { + return false; + } + return _state >= StateClosing; } @@ -232,9 +238,17 @@ Ice::ConnectionI::isFinished() const IceUtil::ThreadPtr threadPerConnection; { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this); + + if(!sync.acquired()) + { + return false; + } - if(_transceiver != 0 || _dispatchCount != 0) + if(_transceiver != 0 || _dispatchCount != 0 || + (threadPerConnection && + threadPerConnection->getThreadControl() != IceUtil::ThreadControl() && + threadPerConnection->getThreadControl().isAlive())) { return false; } |