[dwm] st - bug with select in run()

From: Christoph Schied <Christoph.Schied_AT_uni-ulm.de>
Date: Wed, 13 May 2009 21:21:37 +0200


I tried the recent version of st (changeset: 45:a0a803566aa4).

After the select call in run(), the timeout argument gets changed to the
remaining time to wait, which will result in a timeout of 0 after a few
iterations. (I think thats implemenetation dependand behaviour)
Attached is a patch to fix this issue.

Anyway, the algorithm to find out about the next event (input or x
event) is not ideal because it will cause the cpu to wake up pretty
often, even if there is nothing happening in the terminal. I dont know
much about XLib, is there possibility to find out about a new X Event by
querying a fd, which could be added to select?

greetings, Christoph Schied

diff -r a0a803566aa4 st.c
--- a/st.c Sun May 10 23:32:21 2009 +0200
+++ b/st.c Wed May 13 21:13:49 2009 +0200
@@ -891,6 +891,7 @@
                 FD_SET(cmdfd, &rfd);
+ tv.tv_usec = 10000;
                 ret = select(cmdfd+1, &rfd, NULL, NULL, &tv);
                 if(ret < 0) {
                         fprintf(stderr, "select: %m\n");
Received on Wed May 13 2009 - 19:21:37 UTC

This archive was generated by hypermail 2.2.0 : Wed May 13 2009 - 19:36:05 UTC