Commit 6803bfe9 authored by Vic Lee's avatar Vic Lee Committed by Christian Beier

Avoid 100% CPU usage when calling ReadFromRFBServer and no available bytes to read

Signed-off-by: 's avatarVic Lee <llyzs@163.com>
Signed-off-by: 's avatarChristian Beier <dontmind@freeshell.org>
parent 47fc9fdd
......@@ -150,6 +150,11 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError();
#endif
if (errno == EWOULDBLOCK || errno == EAGAIN) {
#ifndef WIN32
usleep (10000);
#else
Sleep (10);
#endif
/* TODO:
ProcessXtEvents();
*/
......@@ -191,6 +196,11 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError();
#endif
if (errno == EWOULDBLOCK || errno == EAGAIN) {
#ifndef WIN32
usleep (10000);
#else
Sleep (10);
#endif
/* TODO:
ProcessXtEvents();
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment