diff options
author | Vic Lee <llyzs@163.com> | 2010-02-09 22:05:13 +0800 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2010-10-13 19:39:59 +0200 |
commit | 6803bfe9d5b9f52215c2aecc25cd9ab9a22c07e3 (patch) | |
tree | ebf26db21004dd7af5358825b3e28c4e6a6e70b4 /libvncclient/sockets.c | |
parent | 47fc9fdd597be5d3285f688706b8832020efd3e1 (diff) | |
download | libvncserver-6803bfe9d5b9f52215c2aecc25cd9ab9a22c07e3.zip libvncserver-6803bfe9d5b9f52215c2aecc25cd9ab9a22c07e3.tar.gz |
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>
Diffstat (limited to 'libvncclient/sockets.c')
-rw-r--r-- | libvncclient/sockets.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index e9a4b53..a4caaa5 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -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(); */ |