repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 413ec816232b65a87ac84706600a6f4288abefe3:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 413ec816232b65a87ac84706600a6f4288abefe3
Author: Marc Lehmann 
Date:   Sun Jan 1 05:28:28 2006 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index 863891acf8e3847a38223f68366c21b4fbc5c1b1..
index ..b0dbe4eb23ef9c3dd30bc3ee2af4f4015e3cb51f 100644
--- a/Changes
+++ b/Changes
@@ -28,6 +28,7 @@ WISH: just for fun, do shade and tint with XRender.
           on a few architectures). Reported by darix.
         - include one trailing space in rectangular selections to indicate
           the inserted newline (yeah, weird, but visually more pleasing).
+        - try to use sched_yield to improve terminal data transfer efficiency.
         - further minor cleanups.

 6.1  Tue Dec 27 13:23:40 CET 2005
diff --git a/src/command.C b/src/command.C
index f52f1a3dac85718422617f9c89fe21308a4057d1..
index ..23090b7b1ccda6eb495f03aa652d832837a3900f 100644
--- a/src/command.C
+++ b/src/command.C
@@ -56,6 +56,11 @@

 #include 

+#define HAVE_SCHED_YIELD 1 //D//TODO//FIXME
+#if HAVE_SCHED_YIELD
+# include 
+#endif
+
 /*----------------------------------------------------------------------*/

 #define IS_CONTROL(ch) !((ch) & 0xffffff60UL)
@@ -1082,14 +1087,20 @@ rxvt_term::pty_fill ()
   cmdbuf_ptr = cmdbuf_base;
   cmdbuf_endp = cmdbuf_ptr + n;

-  n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
+  ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);

-  if (n > 0)
+  if (r > 0)
     {
-      cmdbuf_endp += n;
+      cmdbuf_endp += r;
       return true;
     }
-  else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0)
+  else if (r < 0 && (errno == EAGAIN || errno == EINTR))
+    {
+#if HAVE_SCHED_YIELD
+      sched_yield ();
+#endif
+    }
+  else
     {
       pty_ev.stop ();

-----END OF PAGE-----