home · contact · privacy
Server: Poll server/in only every 0.33 seconds to reduce CPU usage.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 31 Mar 2014 02:12:58 +0000 (04:12 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 31 Mar 2014 02:12:58 +0000 (04:12 +0200)
TODO
src/server/io.c

diff --git a/TODO b/TODO
index b90cb760869500a4469917c237421ae5bf691744..42c0e9a45c7d144e1a0f6261bb86c595df0e5819 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,8 +11,6 @@ BOTH SERVER/CLIENT:
 
 - in textfield_width(), handle too large lines somehow
 
-- use select() polling where possible for server-client communication
-
 - may err_line store the processed line internally as it does the line count
 
 SERVER:
index 28c76b8f558754b5c377cd71ccd816a357e242c0..ba5abd5f2d18b2c95000fe7381b244aae6df455f 100644 (file)
@@ -1,5 +1,6 @@
 /* src/server/io.c */
 
+#define _BSD_SOURCE /* usleep() */
 #include "io.h"
 #include <errno.h> /* global errno */
 #include <limits.h> /* PIPE_BUF */
@@ -10,6 +11,7 @@
 #include <string.h> /* strlen(), memcpy() */
 #include <sys/types.h> /* time_t */
 #include <time.h> /* time() */
+#include <unistd.h> /* usleep() */
 #include "../common/err_try_fgets.h" /* err_line() */
 #include "../common/readwrite.h" /* try_fopen(), try_fclose_unlink_rename(),
                                   * try_fwrite(), try_fputc(), try_fgetc()
@@ -94,6 +96,7 @@ static void read_file_into_queue()
     int test;
     while (EOF == (test = try_fgetc(world.file_in, f_name)))
     {
+        usleep(33);
         if (time(0) > now + wait_seconds)
         {
             return;