]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
reverted the new stop protocol introduced yesterday. The current scheme for
authorhadaq <hadaq>
Thu, 15 Nov 2001 12:59:54 +0000 (12:59 +0000)
committerhadaq <hadaq>
Thu, 15 Nov 2001 12:59:54 +0000 (12:59 +0000)
inserting log info into the DB doesn't need it.

hadaq/agent.c
hadaq/daq_lib.c
hadaq/worker.c
hadaq/worker.h

index c0d315ba84ed977b67972fce137ad224346c4f54..1511781642cc355d2c89d3afaa358ea895fbb511 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/agent.c,v 6.6 2001-11-14 17:18:52 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/agent.c,v 6.7 2001-11-15 12:59:54 hadaq Exp $";
 
 #include <rpc/rpc.h>
 #include "agent.h"
@@ -76,7 +76,6 @@ int *rpcworker_stop_1(int *id, CLIENT * cl)
 {
        static int retVal;
 
-       Worker_halt(getWorker(*id), 15);
        Worker_stop(getWorker(*id), 15);
        removeWorker(*id);
 
index f506d843c9408d9d9802b862b180178e41e916b1..e897dda6f0e1d0c344f0e4b9c0c397530022deda 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/daq_lib.c,v 6.8 2001-11-15 10:20:18 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/daq_lib.c,v 6.9 2001-11-15 12:59:54 hadaq Exp $";
 
 
 #include <stdlib.h>
@@ -48,8 +48,6 @@ int Daq_start(const char *n, const Param *p)
 int Daq_stop(const char *n, const Param *p)
 {
        exportSetup(p);
-       Worker_halt(n, 15);
-       puts(Worker_status(n));
        Worker_stop(n, 15);
        return 0;
 }
index 85ee33fea9967bf5abd58881baf3c5e79123bb4a..f53ff6ad370dcad6c5e23ce4d38433f8bcfe0b63 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.10 2001-11-14 17:18:52 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.11 2001-11-15 12:59:54 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -162,8 +162,6 @@ Worker *Worker_initBegin(const char *name, void (*sigHandler) (int), int priorit
 {
        Worker *retVal;
        Worker *my;
-       int s0;
-       int s1;
 
        if (NULL == (my = malloc(sizeof(Worker)))) {
                syslog(LOG_ERR, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
@@ -174,24 +172,19 @@ Worker *Worker_initBegin(const char *name, void (*sigHandler) (int), int priorit
        my->pid = getpid();
        my->isStandalone = isStandalone;
 
-       if (!my->isStandalone) {
-               s0 = SIGUSR1;
-               s1 = SIGUSR2;
-       } else {
-               s0 = SIGINT;
-               s1 = SIGTERM;
-       }
-
-       if (-1 == installSigHandlers(my, s0, s1, sigHandler)) {
+       if (-1 == installSigHandlers(my, SIGINT, SIGTERM, sigHandler)) {
                syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
+               Worker_fini(my);
                retVal = NULL;
        } else if (-1 == createStatShm(my)) {
                syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
-               removeSigHandlers(my);
+               Worker_fini(my);
                retVal = NULL;
        } else {
-               my->pidP = Worker_addStatistic(my, "pid");
-               *my->pidP = my->pid;
+               unsigned long *pidP;
+
+               pidP = Worker_addStatistic(my, "pid");
+               *pidP = my->pid;
 
                if (0 > changePriority(priority)) {
                        syslog(LOG_WARNING, "changeing priority: %s", strerror(errno));
@@ -215,21 +208,6 @@ void Worker_initEnd(Worker *my)
 
 void Worker_fini(Worker *my)
 {
-
-       if (!my->isStandalone) {
-               sigset_t sigMaskS, *sigMask = &sigMaskS;
-
-               removeSigHandlers(my);
-               installSigHandlers(my, SIGINT, SIGTERM, noopHandler);
-
-               *my->pidP |= (1 << 31);
-
-               /* BUGBUG there should be a timeout here */
-               sigemptyset(sigMask);
-               sigsuspend(sigMask);
-       }
-
-
        removeStatShm(my);
        removeSigHandlers(my);
 
@@ -311,25 +289,6 @@ char *Worker_status(const char *name)
        return retVal;
 }
 
-void Worker_halt(const char *name, int timeout)
-{
-       Worker myS, *my = &myS;
-
-       strcpy(my->name, name);
-
-       if (0 == openStatShm(my)) {
-               my->pid = my->statistics[0].value;
-               if (my->pid > 0) {
-                       if (0 == kill(my->pid, SIGUSR1)) {
-                               while (((my->pid = my->statistics[0].value) & (1 << 31)) == 0) {
-                                       sleep(1);
-                               }
-                       }
-               }
-               closeStatShm(my);
-       }
-}
-
 void Worker_stop(const char *name, int timeout)
 {
        Worker myS, *my = &myS;
@@ -337,14 +296,13 @@ void Worker_stop(const char *name, int timeout)
        strcpy(my->name, name);
 
        if (0 == openStatShm(my)) {
-               my->pid = my->statistics[0].value & ~(1 << 31);
+               my->pid = my->statistics[0].value;
                if (my->pid > 0) {
                        if (0 == kill(my->pid, SIGTERM)) {
                                sleep(1);
                                wait(NULL);
                        }
                }
-               closeStatShm(my);
        }
 }
 
index a7e4f4f91950f338bfd280fa751b38109fd00ca9..6df883524e4ab10c31278568d38eb7724ad51f38 100644 (file)
@@ -24,7 +24,6 @@ typedef struct WorkerS {
        PsxShm *shm;
        Statistic *statistics;
        pid_t pid;
-       unsigned long *pidP;
        int isStandalone;
 } Worker;