Added 'polling' option to options.conf.
authorAndreas Eversberg <jolly@eversberg.eu>
Wed, 17 Mar 2010 09:43:04 +0000 (10:43 +0100)
committerAndreas Eversberg <jolly@eversberg.eu>
Wed, 17 Mar 2010 09:43:04 +0000 (10:43 +0100)
This is usefull to test if select loop causes problems and does not wake
when it is required. If lcr seems not to wake up, try using 'polling' to
disable select timer and use polling instead.

default/options.conf
main.c
options.c
options.h
todo.txt

index 64d0f27..e0e93a0 100644 (file)
 #
 #gsm
 
 #
 #gsm
 
+# Enable polling in main loop.
+# This feature is temporarily for test purpose. Don't enable it
+#polling
diff --git a/main.c b/main.c
index 9d7f834..e2d3f13 100644 (file)
--- a/main.c
+++ b/main.c
@@ -460,7 +460,11 @@ int main(int argc, char *argv[])
                        usleep(10000);
                }
 #else
                        usleep(10000);
                }
 #else
-               select_main(0, NULL, NULL, NULL);
+               if (options.polling)
+                       if (!select_main(1, NULL, NULL, NULL))
+                               usleep(10000);
+               else
+                       select_main(0, NULL, NULL, NULL);
 #endif
        }
        SPRINT(tracetext, "%s terminated", NAME);
 #endif
        }
        SPRINT(tracetext, "%s terminated", NAME);
index 1cadbe5..88f6424 100644 (file)
--- a/options.c
+++ b/options.c
@@ -35,7 +35,8 @@ struct options options = {
        0700,                           /* rights of lcr admin socket */
        -1,                             /* socket user (-1= no change) */
        -1,                             /* socket group (-1= no change) */
        0700,                           /* rights of lcr admin socket */
        -1,                             /* socket user (-1= no change) */
        -1,                             /* socket group (-1= no change) */
-       0                               /* enable gsm */
+       0,                              /* enable gsm */
+       1                               /* use polling of main loop */
 };
 
 char options_error[256];
 };
 
 char options_error[256];
@@ -235,6 +236,9 @@ int read_options(char *options_error)
                } else
                if (!strcmp(option,"gsm")) {
                        options.gsm = 1;
                } else
                if (!strcmp(option,"gsm")) {
                        options.gsm = 1;
+               } else
+               if (!strcmp(option,"polling")) {
+                       options.polling = 1;
                } else {
                        UPRINT(options_error, "Error in %s (line %d): wrong option keyword %s.\n", filename,line,option);
                        goto error;
                } else {
                        UPRINT(options_error, "Error in %s (line %d): wrong option keyword %s.\n", filename,line,option);
                        goto error;
index 1a256e2..c13ee2c 100644 (file)
--- a/options.h
+++ b/options.h
@@ -30,6 +30,7 @@ struct options {
        int     socketuser;             /* socket chown to this user */
        int     socketgroup;            /* socket chgrp to this group */
        int     gsm;                    /* enable gsm support */
        int     socketuser;             /* socket chown to this user */
        int     socketgroup;            /* socket chgrp to this group */
        int     gsm;                    /* enable gsm support */
+       int     polling;
 };     
 
 extern struct options options;
 };     
 
 extern struct options options;
index c6b6993..896a0d0 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -15,5 +15,5 @@ doku:
 - neuen partyline-param dokumentieren
 - aufzeichnung der ansage mit 0 ohne beep beenden
 - gain, pipeline, crypt
 - neuen partyline-param dokumentieren
 - aufzeichnung der ansage mit 0 ohne beep beenden
 - gain, pipeline, crypt
-
+- polling