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

Signed-off-by: Vic Lee <llyzs@163.com>
Signed-off-by: Christian Beier <dontmind@freeshell.org>
pull/1/head
Vic Lee 13 years ago committed by Christian Beier
parent 47fc9fdd59
commit 6803bfe9d5

@ -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();
*/

Loading…
Cancel
Save