Commit 9482db60 authored by Karl Heyes's avatar Karl Heyes

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.

svn path=/trunk/icecast/; revision=5174
parent 69de4ea6
......@@ -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 @@ void connection_accept_loop(void)
_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) {
......
......@@ -24,6 +24,8 @@ void _sig_hup(int signo);
void _sig_die(int signo);
#endif
int schedule_config_reread = 0;
void sighandler_initialize(void)
{
#ifndef _WIN32
......@@ -38,18 +40,7 @@ void sighandler_initialize(void)
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);
}
......
#ifndef __SIGHANDLER_H__
#define __SIGHANDLER_H__
extern int schedule_config_reread;
void sighandler_initialize(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment