From 7ecbe35d830e188e22195aa8898e2b160c1ccf79 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Sun, 18 Dec 2011 12:07:40 +0400 Subject: [PATCH] move Main Loop to a separate clone process --- yasnd.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/yasnd.c b/yasnd.c index 142aa39..8e7ac0e 100644 --- a/yasnd.c +++ b/yasnd.c @@ -22,6 +22,7 @@ char* phone_connection=NULL; // gammu phone connection type, for example: "at" char* recipient_number=NULL; // recipient of sms alerts bool loop_locked=false ; // flag for locking main loop while config re-reading int failures_first=3 ; // count of failures while hosts checking, that triggers first SMS sending +pid_t mainloop_clone_pid; // pid of clone process, that containt main loop void log_debug(const char *message,int verbosity) { @@ -158,8 +159,12 @@ void reset_pin(int pin_num) outb (0, LPTPORT); } -void loop_function() +int loop_function() { + // set default signal handlers + signal(SIGTERM,SIG_DFL); + signal(SIGHUP,SIG_DFL); + // for (int i=0;i