diff options
author | Parth Chandra <pchandra@maprtech.com> | 2015-03-20 16:15:03 -0700 |
---|---|---|
committer | Parth Chandra <pchandra@maprtech.com> | 2015-03-24 12:12:19 -0700 |
commit | bebfe8ae92669dab0891e216d391297d6187a745 (patch) | |
tree | 1fbbffa58581ddb37b146080e1a23b11aaa9ca25 /contrib | |
parent | 2f2338f3f8b66921d6db223064bb23ff41894486 (diff) |
DRILL-2509: C++ client - concurrency issue with m_pendingRequests
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/native/client/src/clientlib/drillClientImpl.cpp | 4 | ||||
-rw-r--r-- | contrib/native/client/src/clientlib/drillClientImpl.hpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp index e6f8009e6..d14119d3a 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.cpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp @@ -346,7 +346,8 @@ DrillClientQueryResult* DrillClientImpl::SubmitQuery(::exec::shared::QueryType t uint64_t coordId; DrillClientQueryResult* pQuery=NULL; { - boost::lock_guard<boost::mutex> lock(this->m_dcMutex); + boost::lock_guard<boost::mutex> prLock(this->m_prMutex); + boost::lock_guard<boost::mutex> dcLock(this->m_dcMutex); coordId = this->getNextCoordinationId(); OutBoundRpcMessage out_msg(exec::rpc::REQUEST, exec::user::RUN_QUERY, coordId, &query); sendSync(out_msg); @@ -782,6 +783,7 @@ void DrillClientImpl::handleRead(ByteBuf_t _buf, } if(!error){ InBoundRpcMessage msg; + boost::lock_guard<boost::mutex> lock(this->m_prMutex); DRILL_LOG(LOG_TRACE) << "Getting new message" << std::endl; AllocatedBufferPtr allocatedBuffer=NULL; diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp index a6de40b48..33f81dbbf 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.hpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp @@ -306,6 +306,8 @@ class DrillClientImpl{ // number of outstanding read requests. // handleRead will keep asking for more results as long as this number is not zero. size_t m_pendingRequests; + //mutex to protect m_pendingRequests + boost::mutex m_prMutex; // Error Object. NULL if no error. Set if the error is valid for ALL running queries. // All the query result objects will |