]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Good idea from Wolfgang -- mm
authorhadaq <hadaq>
Sun, 27 Oct 2002 12:26:33 +0000 (12:26 +0000)
committerhadaq <hadaq>
Sun, 27 Oct 2002 12:26:33 +0000 (12:26 +0000)
hadaq/hwshow.c

index 677bc0c9e62e58e35636323e96954dfb0534abb9..b284c9e567692ce87ef94e5aba0208d4953df543 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwshow.c,v 6.30 2002-10-27 09:11:14 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwshow.c,v 6.31 2002-10-27 12:26:33 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -100,6 +100,8 @@ void Hardware_waitForTrigger(Hardware *my, void *subEvt)
 {
        int i;
        int nRequests = 0;
+       int nPoll = 0;
+       const int nPollMax = 60 / my->nShips;
 
        for (i = 0; i < my->nShips; i++) {
                if (HwShip_isEmpty(my->ship[i])) {
@@ -117,13 +119,13 @@ void Hardware_waitForTrigger(Hardware *my, void *subEvt)
                                }
                        }
                }
-#if 0
+#if 1
 /*
 * This sleep prevents a tight loop which stops work on real
 * time systems if the priority of readout is not lowered.
 * When not using the sleep use option -p -2 for daq_readout.
 */
-               if (nRequests == my->nShips) {
+               if (nRequests == my->nShips && nPoll++ >= nPollMax) {
                        struct timespec tS, *t = &tS;
                        t->tv_sec = 0;
                        t->tv_nsec = 020000000;