void CWizDocumentEditStatusSyncThread::sendDoneMessage() { m_mutext.lock(); QMap<QString, QString> doneList(m_doneMap); m_mutext.unlock(); QMap<QString, QString>::const_iterator it; for ( it = doneList.begin(); it != doneList.end(); ++it ) { if (!it.key().isEmpty() && !it.value().isEmpty()) { if (sendDoneMessage(it.value(), it.key())) { m_mutext.lock(); m_doneMap.remove(it.key()); m_mutext.unlock(); } } } }
void WizDocumentEditStatusSyncThread::run() { while (!m_stop) { m_mutex.lock(); m_wait.wait(&m_mutex); emit stopTimer(); if (m_stop) { m_mutex.unlock(); return; } m_mutex.unlock(); // sendEditingMessage(); sendDoneMessage(); } }
void CWizDocumentEditStatusSyncThread::run() { int idleCounter = 0; while (1) { if (idleCounter >= 30 || m_sendNow || m_stop) { sendEditingMessage(); sendDoneMessage(); // idleCounter = 0; m_sendNow = false; // if (m_stop) return; } else { idleCounter++; msleep(1000); } } }