Fixed Ipc unit test intermittently fail #4721

This commit is contained in:
Jerry (Xinyu Hou) 2015-07-21 14:10:50 -07:00
parent 1369f46cee
commit 9d44affc89
2 changed files with 12 additions and 0 deletions

View File

@ -67,6 +67,8 @@ IpcLogOutputter::~IpcLogOutputter()
ARCH->closeMutex(m_bufferMutex); ARCH->closeMutex(m_bufferMutex);
if (m_bufferThread != nullptr) { if (m_bufferThread != nullptr) {
m_bufferThread->cancel();
m_bufferThread->wait();
delete m_bufferThread; delete m_bufferThread;
} }

View File

@ -35,6 +35,16 @@ public:
m_sendCond(ARCH->newCondVar()), m_sendCond(ARCH->newCondVar()),
m_sendMutex(ARCH->newMutex()) { } m_sendMutex(ARCH->newMutex()) { }
~MockIpcServer() {
if (m_sendCond != NULL) {
ARCH->closeCondVar(m_sendCond);
}
if (m_sendMutex != NULL) {
ARCH->closeMutex(m_sendMutex);
}
}
MOCK_METHOD0(listen, void()); MOCK_METHOD0(listen, void());
MOCK_METHOD2(send, void(const IpcMessage&, EIpcClientType)); MOCK_METHOD2(send, void(const IpcMessage&, EIpcClientType));
MOCK_CONST_METHOD1(hasClients, bool(EIpcClientType)); MOCK_CONST_METHOD1(hasClients, bool(EIpcClientType));