From 80d7cb6e16908f7f254a1ce3dd2ba18f8d56f829 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Fri, 23 Mar 2012 17:46:32 +0400 Subject: [PATCH] migrate main loop function call from clone to pthread --- daemon/yasnd.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/daemon/yasnd.c b/daemon/yasnd.c index 0200fa0..a1d0d30 100644 --- a/daemon/yasnd.c +++ b/daemon/yasnd.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,7 @@ bool loop_locked=false; // flag for locking main loop while config re-reading long failures_first=0; // count of failures while hosts checking, that triggers SMS sending long failures_second=0; // count of failures while hosts checking, that triggers host's reset long failures_third=0; // count of failures while hosts checking, that clean failure statistics -pid_t mainloop_clone_pid; // pid of clone process, that containt main loop +pthread_t mainloop_handle; // handle of main loop thread void* allocate_memory(int bytes) { @@ -179,12 +180,8 @@ void check_host(int num,host_decl* host) host->helper_pid=pid; } -int loop_function() +void* loop_function(void* param) { - // set default signal handlers - signal(SIGTERM,SIG_DFL); - signal(SIGHUP,SIG_DFL); - // for (int i=0;i