X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fserver%2Fio.c;h=c4c60478ec0253b1c17695e23006afb7baca49fb;hb=ef60270da2acf29953b411632e26503d7787d9d8;hp=035f4fe1d0759436f6dc5aed53710df00e82177b;hpb=d12efb0addf420adc045cfb96647dff6241310ee;p=plomrogue
diff --git a/src/server/io.c b/src/server/io.c
index 035f4fe..c4c6047 100644
--- a/src/server/io.c
+++ b/src/server/io.c
@@ -1,5 +1,6 @@
/* src/server/io.c */
+#define _BSD_SOURCE /* usleep() */
#include "io.h"
#include /* global errno */
#include /* PIPE_BUF */
@@ -10,6 +11,8 @@
#include /* strlen(), memcpy() */
#include /* time_t */
#include /* time() */
+#include /* 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()
*/
@@ -27,8 +30,8 @@
*/
static char * get_message_from_queue();
-/* Read input file for input into world.queue. new queue input. Wait a few
- * seconds until giving up. Translate '\n' chars in input file into '\0' chars.
+/* Poll input file for world.queue input. Wait a few seconds until giving up;
+ * poll only every 0.03 seconds.. Translate '\n' chars in input file into '\0'.
*/
static void read_file_into_queue();
@@ -93,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;