diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-02-03 10:42:29 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-02-03 10:42:29 +0100 |
commit | 18a6720fcc3ece576f5fb26283e239cda2bebadd (patch) | |
tree | a7d9de0acab9e092943fb182fa880b2c4b950db6 /cpp/src/Ice/IncomingAsync.cpp | |
parent | ICE-6861 - Java stream API changes (diff) | |
download | ice-18a6720fcc3ece576f5fb26283e239cda2bebadd.tar.bz2 ice-18a6720fcc3ece576f5fb26283e239cda2bebadd.tar.xz ice-18a6720fcc3ece576f5fb26283e239cda2bebadd.zip |
Refactored invocation code to better suite new C++11 mapping
Diffstat (limited to 'cpp/src/Ice/IncomingAsync.cpp')
-rw-r--r-- | cpp/src/Ice/IncomingAsync.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index 835963b9c0d..e1748a06828 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -56,23 +56,14 @@ Init init; IceInternal::IncomingAsync::IncomingAsync(Incoming& in) : IncomingBase(in), _instanceCopy(_os.instance()), -#ifdef ICE_CPP11_MAPPING - _responseHandlerCopy(dynamic_pointer_cast<ResponseHandler>(_responseHandler->shared_from_this())), -#else - _responseHandlerCopy(_responseHandler), -#endif + _responseHandlerCopy(_responseHandler->shared_from_this()), // Acquire reference on response handler _retriable(in.isRetriable()), _active(true) { #ifndef ICE_CPP11_MAPPING if(_retriable) { - // - // With C++11 maping we cannot call setActive from the ctor as - // it creates a smart pointer to this object, and with shared_ptr - // this requires a fully constructed object. - // - in.setActive(*this); + in.setActive(this); } #endif } @@ -81,10 +72,10 @@ IceInternal::IncomingAsync::IncomingAsync(Incoming& in) : IncomingAsyncPtr IceInternal::IncomingAsync::create(Incoming& in) { - IncomingAsyncPtr self(new IncomingAsync(in)); + IncomingAsyncPtr self = make_shared<IncomingAsync>(in); if(in.isRetriable()) { - in.setActive(*self.get()); + in.setActive(self->shared_from_this()); } return self; } @@ -136,7 +127,7 @@ IceInternal::IncomingAsync::ice_exception(const ::std::exception& ex) { return; } - + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); if(!_active) { @@ -187,7 +178,7 @@ IceInternal::IncomingAsync::ice_exception() { return; } - + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); if(!_active) { @@ -306,7 +297,7 @@ IceInternal::IncomingAsync::__validateResponse(bool ok) { return false; } - + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex); if(!_active) { |