[Xcb-commit] 2 commits - xcb

Eric Anholt anholt at kemper.freedesktop.org
Sun Apr 9 19:55:53 PDT 2006


 xcb/src/xcb_conn.c |    6 +++++-
 xcb/src/xcb_in.c   |    4 +++-
 xcb/src/xcb_util.c |    1 -
 3 files changed, 8 insertions(+), 3 deletions(-)

New commits:
diff-tree ee0eb7b82a75177f87d2b4a36f4239c1de415bcc (from 2b7a51c7bb8e4264bdab5f613c234fe4955b9f70)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Apr 9 19:51:10 2006 -0700

    Retry a select() if it returns with EINTR.  Fixes IO errors in Xephyr, which is
    often interrupted by timers.

diff --git a/xcb/src/xcb_conn.c b/xcb/src/xcb_conn.c
index 1e93137..95b5fa2 100644
--- a/xcb/src/xcb_conn.c
+++ b/xcb/src/xcb_conn.c
@@ -253,7 +253,11 @@ int _xcb_conn_wait(XCBConnection *c, pth
     }
 
     pthread_mutex_unlock(&c->iolock);
-    ret = select(c->fd + 1, &rfds, &wfds, 0, 0) > 0;
+    do {
+	ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
+    } while (ret == -1 && errno == EINTR);
+    if (ret < 0)
+	ret = 0;
     pthread_mutex_lock(&c->iolock);
 
     if(ret)
diff --git a/xcb/src/xcb_in.c b/xcb/src/xcb_in.c
index fa13e90..76f9702 100644
--- a/xcb/src/xcb_in.c
+++ b/xcb/src/xcb_in.c
@@ -229,7 +229,9 @@ static int read_block(const int fd, void
             fd_set fds;
             FD_ZERO(&fds);
             FD_SET(fd, &fds);
-            ret = select(fd + 1, &fds, 0, 0, 0);
+	    do {
+		ret = select(fd + 1, &fds, 0, 0, 0);
+	    } while (ret == -1 && errno == EINTR);
         }
         if(ret <= 0)
             return ret;
diff-tree 2b7a51c7bb8e4264bdab5f613c234fe4955b9f70 (from 2443d665a9b5b23db13ca1dfb778476c47a46d0b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Apr 9 19:19:12 2006 -0700

    Remove unnecessary include.  Noticed by jamey.

diff --git a/xcb/src/xcb_util.c b/xcb/src/xcb_util.c
index 93e180c..343e21f 100644
--- a/xcb/src/xcb_util.c
+++ b/xcb/src/xcb_util.c
@@ -27,7 +27,6 @@
 
 #include <assert.h>
 #include <sys/types.h>
-#include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>


More information about the xcb-commit mailing list