do not busy loop while sending

This commit is contained in:
Benjamin Sergeant committed 2019-03-14 14:48:08 -07:00
1 parent 6cc260c04e
commit ded03ed743
3 files changed
+62 -3

No files matched your search

+6
View File
@@ -198,6 +198,12 @@ namespace ix
while (!isSendBufferEmpty() && !_requestInitCancellation)
{
sendOnSocket();
// Sleep 10ms between each send so that we dont busy loop
// A better strategy would be to select on the socket to
// check whether we can write to it without blocking
std::chrono::duration<double, std::micro> duration(10);
std::this_thread::sleep_for(duration);
}
}
else if (pollResult == PollResultType_ReadyForRead)