- a bold attempt to push the socket read threads to read continuously to see if this is:

a) stable without causing out of synch
b) not too hard on the CPU
This commit is contained in:
Mark Vejvoda
2011-11-25 17:01:35 +00:00
parent 2a8c712b1a
commit 4e882796a1
8 changed files with 225 additions and 74 deletions

View File

@@ -108,7 +108,24 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
}
}
std::vector<ChatMsgInfo> NetworkInterface::getChatTextList(bool clearAfterRetrieve) {
std::vector<ChatMsgInfo> result;
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
result = chatTextList;
if(clearAfterRetrieve == true) {
chatTextList.clear();
}
return result;
}
void NetworkInterface::addChatInfo(const ChatMsgInfo &msg) {
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
chatTextList.push_back(msg);
}
void NetworkInterface::clearChatInfo() {
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
if(chatTextList.empty() == false) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,chatTextList.size());
chatTextList.clear();