Revised mbtask shutdown procedure
This commit is contained in:
parent
6519357e2f
commit
0998736e65
@ -31,6 +31,7 @@ v0.39.4 08-Dec-2003
|
|||||||
|
|
||||||
mbtask:
|
mbtask:
|
||||||
Moved the scheduler in a thread.
|
Moved the scheduler in a thread.
|
||||||
|
Rewrote shutdown procedure to make it more portable.
|
||||||
|
|
||||||
script:
|
script:
|
||||||
Dropped support for Slackware pre 7.0.
|
Dropped support for Slackware pre 7.0.
|
||||||
|
@ -661,6 +661,8 @@ void start_shutdown(int onsig)
|
|||||||
Syslog('+', "Trigger shutdown on signal %s", SigName[onsig]);
|
Syslog('+', "Trigger shutdown on signal %s", SigName[onsig]);
|
||||||
signal(onsig, SIG_IGN);
|
signal(onsig, SIG_IGN);
|
||||||
G_Shutdown = TRUE;
|
G_Shutdown = TRUE;
|
||||||
|
if (nodaemon && (onsig == SIGINT))
|
||||||
|
die(SIGTERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1027,26 +1029,12 @@ void *scheduler(void)
|
|||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
#endif
|
#endif
|
||||||
int call_work = 0, rc;
|
int call_work = 0;
|
||||||
static int call_entry = MAXTASKS;
|
static int call_entry = MAXTASKS;
|
||||||
double loadavg[3];
|
double loadavg[3];
|
||||||
pp_list *tpl;
|
pp_list *tpl;
|
||||||
// sigset_t sigset, oldset;
|
|
||||||
|
|
||||||
Syslog('+', "Starting scheduler thread with pid %d", (int)getpid());
|
Syslog('+', "Starting scheduler thread with pid %d", (int)getpid());
|
||||||
/*
|
|
||||||
rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "pthread_setcancelstate(PTHREAD_CANCEL_DISABLE) rc=%d", rc);
|
|
||||||
|
|
||||||
rc = sigfillset(&sigset);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "sigfillset() rc=%d", rc);
|
|
||||||
rc = pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "pthread_sigmask(SIG_SETMASK) rc=%d", rc);
|
|
||||||
*/
|
|
||||||
|
|
||||||
sched_run = TRUE;
|
sched_run = TRUE;
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
|
|
||||||
|
@ -338,20 +338,8 @@ void *ping_thread(void)
|
|||||||
static char pingaddress[41];
|
static char pingaddress[41];
|
||||||
static time_t pingsend;
|
static time_t pingsend;
|
||||||
time_t now;
|
time_t now;
|
||||||
// sigset_t sigset, oldset;
|
|
||||||
|
|
||||||
Syslog('+', "Starting ping thread with pid %d", (int)getpid());
|
Syslog('+', "Starting ping thread with pid %d", (int)getpid());
|
||||||
// rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
||||||
// if (rc)
|
|
||||||
// Syslog('+', "pthread_setcancelstate(PTHREAD_CANCEL_DISABLE) rc=%d", rc);
|
|
||||||
|
|
||||||
// rc = sigfillset(&sigset);
|
|
||||||
// if (rc)
|
|
||||||
// Syslog('+', "sigfillset() rc=%d", rc);
|
|
||||||
// rc = pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
|
|
||||||
// if (rc)
|
|
||||||
// Syslog('+', "pthread_sigmask(SIG_SETMASK) rc=%d", rc);
|
|
||||||
|
|
||||||
pingresult[1] = pingresult[2] = FALSE;
|
pingresult[1] = pingresult[2] = FALSE;
|
||||||
pingnr = 2;
|
pingnr = 2;
|
||||||
internet = FALSE;
|
internet = FALSE;
|
||||||
|
@ -583,21 +583,8 @@ void *cmd_thread(void)
|
|||||||
int rlen, rc;
|
int rlen, rc;
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
static char buf[2048];
|
static char buf[2048];
|
||||||
// sigset_t sigset, oldset;
|
|
||||||
|
|
||||||
Syslog('+', "Starting cmd thread with pid %d", (int)getpid());
|
Syslog('+', "Starting cmd thread with pid %d", (int)getpid());
|
||||||
/*
|
|
||||||
rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "pthread_setcancelstate(PTHREAD_CANCEL_DISABLE) rc=%d", rc);
|
|
||||||
|
|
||||||
rc = sigfillset(&sigset);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "sigfillset() rc=%d", rc);
|
|
||||||
rc = pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
|
|
||||||
if (rc)
|
|
||||||
Syslog('+', "pthread_sigmask(SIG_SETMASK) rc=%d", rc);
|
|
||||||
*/
|
|
||||||
cmd_run = TRUE;
|
cmd_run = TRUE;
|
||||||
|
|
||||||
while (! T_Shutdown) {
|
while (! T_Shutdown) {
|
||||||
|
Reference in New Issue
Block a user