1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

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
This commit is contained in:
Karl Heyes 2003-07-24 23:45:29 +00:00
parent 69de4ea61e
commit 9482db6016
3 changed files with 16 additions and 13 deletions

View File

@ -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) {

View File

@ -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);
}

View File

@ -1,6 +1,7 @@
#ifndef __SIGHANDLER_H__
#define __SIGHANDLER_H__
extern int schedule_config_reread;
void sighandler_initialize(void);