Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Christoph Lohmann
Hello. On Sun, 16 Sep 2012 14:00:44 +0200 Aurélien Aptel wrote: > On Sun, Sep 16, 2012 at 12:26 PM, Christoph Lohmann <2...@r-36.net> wrote: > > If there is something to read from the tty, handle it, then wait for > > five microseconds in select() and see if the buffer filled again. If >

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Aurélien Aptel
On Sun, Sep 16, 2012 at 12:26 PM, Christoph Lohmann <2...@r-36.net> wrote: > If there is something to read from the tty, handle it, then wait for > five microseconds in select() and see if the buffer filled again. If > yes, handle this and do it again. After a certain amount of such loops

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Christoph Lohmann
Hello. On Sun, 16 Sep 2012 12:26:21 +0200 Aurélien Aptel wrote: > On Sun, Sep 16, 2012 at 9:47 AM, Roberto E. Vargas Caballero > wrote: > > This serie of patches try fix the problem of the timeout in main loop, which > > causes st wakeup each 20 ms even thare is noting to do. > > The timeout "

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Roberto E. Vargas Caballero
> Maybe a way to improve my patches is testing is some data can be read from > the file descriptors and in this case continue the loop. something like: > > if(i++ < 4) { > struct timeval tv = {0}; > FD_ZERO(&rfd); > FD_SET(cmdfd, &rfd); >

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Roberto E. Vargas Caballero
> The timeout "problem" was introduced to speed up the rendering when a > lot of text is printed. > The logic is basically to not redraw on every read when the throughput is > high: I tried do the same thing putting the draw at the end of the loop, so if you have a high throughput you will read m

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Aurélien Aptel
On Sun, Sep 16, 2012 at 11:51 AM, Aurélien Aptel wrote: > - try to read data for SELECT_TIMEOUT ms max > - if something was read, handle it in the term > - if something was read and the last call to draw was more than > DRAW_TIMEOUT ms ago then redraw. In retrospect, the Right Thing would be to h

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread Aurélien Aptel
On Sun, Sep 16, 2012 at 9:47 AM, Roberto E. Vargas Caballero wrote: > This serie of patches try fix the problem of the timeout in main loop, which > causes st wakeup each 20 ms even thare is noting to do. The timeout "problem" was introduced to speed up the rendering when a lot of text is printed

Re: [dev] [st] Removing timeouts in main loop

2012-09-16 Thread stanio
* Roberto E. Vargas Caballero [2012-09-16 09:48]: > The main loop waits until there is some data to read in file descriptors of > the X server or the pseudo tty. But it uses a timeout in select(), which > causes that st awake each 20 ms, even it doesn't have something to do. This > patch removes t

[dev] [st] Removing timeouts in main loop

2012-09-16 Thread Roberto E. Vargas Caballero
This serie of patches try fix the problem of the timeout in main loop, which causes st wakeup each 20 ms even thare is noting to do. Please send comments and suggestion. Best regards. >From 48aac423ea93820f8a406da3f4e53c8ce4bcb2a6 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date