Author: veithm
Date: Fri May 15 15:07:36 2015
New Revision: 1679589
URL: http://svn.apache.org/r1679589
Log:
Improved mutex handling in EtchConnection
Refactoring of the mutex handling.
Change-Id: I6690b0a9a3237c4430e780d56d5db573fe2cdabb
Modified:
etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h
Modified: etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h
URL:
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h?rev=1679589&r1=1679588&r2=1679589&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h (original)
+++ etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h Fri May
15 15:07:36 2015
@@ -165,29 +165,30 @@ status_t EtchConnection<S>::fireUp() {
mMutex.lock();
EtchString tmp;
mStatus.set(EtchSession::UP(), tmp);
+ mMutex.unlock();
if (mSession != NULL) {
//TODO: run this in seperate thread
- mMutex.unlock();
return mSession->sessionNotify(new EtchString(EtchSession::UP()));
}
- mMutex.unlock();
+
return ETCH_ERROR;
}
template <class S>
status_t EtchConnection<S>::fireDown() {
- mMutex.lock();
- EtchString tmp;
- mStatus.set(EtchSession::DOWN(), tmp);
+ status_t result = ETCH_ERROR;
if (mSession != NULL) {
//TODO: run this in seperate thread
- mMutex.unlock();
- return mSession->sessionNotify(new EtchString(EtchSession::DOWN()));
+ result = mSession->sessionNotify(new EtchString(EtchSession::DOWN()));
}
+
+ mMutex.lock();
+ EtchString tmp;
+ mStatus.set(EtchSession::DOWN(), tmp);
mMutex.unlock();
- return ETCH_ERROR;
+ return result;
}
#endif /* ETCHCONNECTION_H */