#include "servant/Message.h" #include "servant/ServantProxy.h" #include "servant/Communicator.h" namespace tars { void ReqMessage::init(CallType eCallType, ServantProxy *prx) { eStatus = ReqMessage::REQ_REQ; eType = eCallType; bFromRpc = false; callback = NULL; proxy = prx; pObjectProxy = NULL; request.iRequestId = 1; response = std::make_shared(); sReqData = std::make_shared(); pMonitor = NULL; iBeginTime = TNOWMS; iEndTime = 0; adapter = NULL; bPush = false; sched = NULL; iCoroId = 0; } ReqMessage::~ReqMessage() { if(deconstructor) { deconstructor(); } if(pMonitor != NULL) { delete pMonitor; pMonitor = NULL; } } ///////////////////////////////////////////////////////////////////////////// void ReqMonitor::wait() { if(!bMonitorFin) { std::unique_lock lock(mutex); if (!bMonitorFin) { cond.wait(lock, [&] { return bMonitorFin || msg->proxy->tars_communicator()->isTerminating(); }); } } } void ReqMonitor::notify() { std::unique_lock lock(mutex); bMonitorFin = true; cond.notify_one(); } }