avoid mutex use for client slot thread on server to improve performance
This commit is contained in:
parent
4ca6c232cf
commit
6d349b839c
|
@ -288,7 +288,10 @@ void ConnectionSlotThread::execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool socketHasReadData = socket->hasDataToReadWithWait(1000);
|
//bool socketHasReadData = socket->hasDataToReadWithWait(1000);
|
||||||
bool socketHasReadData = socket->hasDataToRead();;
|
//bool socketHasReadData = socket->hasDataToRead();;
|
||||||
|
// Avoid mutex locking
|
||||||
|
//bool socketHasReadData = Socket::hasDataToRead(socket->getSocketId());
|
||||||
|
bool socketHasReadData = Socket::hasDataToReadWithWait(socket->getSocketId(),100000);
|
||||||
|
|
||||||
ConnectionSlotEvent eventCopy;
|
ConnectionSlotEvent eventCopy;
|
||||||
eventCopy.eventType = eReceiveSocketData;
|
eventCopy.eventType = eReceiveSocketData;
|
||||||
|
@ -306,9 +309,9 @@ void ConnectionSlotThread::execute() {
|
||||||
this->slotUpdateTask(&eventCopy);
|
this->slotUpdateTask(&eventCopy);
|
||||||
//printf("#D Checking action for slot: %d\n",slotIndex);
|
//printf("#D Checking action for slot: %d\n",slotIndex);
|
||||||
|
|
||||||
if(socketHasReadData == false && getQuitStatus() == false) {
|
//if(socketHasReadData == false && getQuitStatus() == false) {
|
||||||
sleep(10);
|
// sleep(10);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//printf("#1 Checking action for slot: %d\n",slotIndex);
|
//printf("#1 Checking action for slot: %d\n",slotIndex);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user