[xiph-cvs] cvs commit: icecast/src connection.c sighandler.c sighandler.h

Karl Heyes karl at xiph.org
Thu Jul 24 16:45:29 PDT 2003



karl        03/07/24 19:45:29

  Modified:    src      connection.c sighandler.c sighandler.h
  Log:
  avoid hitting the mutex's in the signal handler, we could block, which is
  not something we want to do. Some mutex implementations are signal based.

Revision  Changes    Path
1.77      +12 -1     icecast/src/connection.c

Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- connection.c	23 Jul 2003 00:27:10 -0000	1.76
+++ connection.c	24 Jul 2003 23:45:29 -0000	1.77
@@ -41,6 +41,7 @@
 #include "logging.h"
 #include "xslt.h"
 #include "fserve.h"
+#include "sighandler.h"
 
 #include "yp.h"
 #include "source.h"
@@ -341,7 +342,17 @@
 
     _build_pool();
 
-    while (global.running == ICE_RUNNING) {
+    while (global.running == ICE_RUNNING)
+    {
+        if (schedule_config_reread)
+        {
+            /* reread config file */
+            INFO0("Scheduling config reread ...");
+
+            connection_inject_event(EVENT_CONFIG_READ, NULL);
+            schedule_config_reread = 0;
+        }
+
         con = _accept_connection();
 
         if (con) {

<p><p>1.7       +3 -12     icecast/src/sighandler.c

Index: sighandler.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/sighandler.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- sighandler.c	21 Jul 2003 01:58:54 -0000	1.6
+++ sighandler.c	24 Jul 2003 23:45:29 -0000	1.7
@@ -24,6 +24,8 @@
 void _sig_die(int signo);
 #endif
 
+int schedule_config_reread = 0;
+
 void sighandler_initialize(void)
 {
 #ifndef _WIN32
@@ -38,18 +40,7 @@
 
 void _sig_hup(int signo)
 {
-    /* We do this elsewhere because it's a bad idea to hang around for too
-     * long re-reading an entire config file inside a signal handler. Bad
-     * practice.
-     */
-
-    INFO1("Caught signal %d, scheduling config reread ...", 
-            signo);
-
-    /* reread config file */
-
-    connection_inject_event(EVENT_CONFIG_READ, NULL);
-    
+    schedule_config_reread = 1;
     /* some OSes require us to reattach the signal handler */
     signal(SIGHUP, _sig_hup);
 }

<p><p>1.2       +1 -0      icecast/src/sighandler.h

Index: sighandler.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/sighandler.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sighandler.h	10 Sep 2001 02:21:49 -0000	1.1
+++ sighandler.h	24 Jul 2003 23:45:29 -0000	1.2
@@ -1,6 +1,7 @@
 #ifndef __SIGHANDLER_H__
 #define __SIGHANDLER_H__
 
+extern int schedule_config_reread;
 
 void sighandler_initialize(void);
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list