From: hadaq Date: Mon, 19 Apr 2010 14:03:18 +0000 (+0000) Subject: runId access fixed. Sergey. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=5c2e476e7f68512277fd8b5ed03e57620f5b2f19;p=daqdata.git runId access fixed. Sergey. --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index daf9fc1..994ad16 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.103 2010-04-16 14:20:19 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.104 2010-04-19 14:03:18 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L #define SYSLOG_NAMES @@ -301,7 +301,7 @@ static void argsDefault(TheArgs *my) strcpy(my->lustrePath, ""); my->buffStat = 0; my->epicsCtrl = 0; - my->ebnum = 1; + my->ebnum = 0; my->ignore = 0; /* read path from DAQ_SETUP and define full file name */ @@ -742,7 +742,7 @@ static void statsBufferDump(TheArgs *theArgs, TheStats *my, float interval, HadT unsigned long runId2print; char buf[_POSIX_PATH_MAX]; - sprintf(buf, "%s%s", progName, theArgs->shmname); + sprintf(buf, "%s%s", "daq_evtbuild", theArgs->shmname); Worker_getStatistic(buf, "runId", &runId2print); printf("ioc: RUN Id = %lu RUN Nr = %lu\n", runId2print, runNr); } @@ -755,14 +755,28 @@ static void statsBufferDump(TheArgs *theArgs, TheStats *my, float interval, HadT unsigned long getRunId(TheArgs *my) { unsigned long myRunId = 0; + char buf[_POSIX_PATH_MAX]; struct timespec tv = { 0, 1e+8 }; + static time_t t0 = 0; + time_t t, dT; + while (my->epicsCtrl && myRunId == 0) { - if (Worker_getStatistic("daq_evtbuild", "runId", &myRunId) == -1) { + + sprintf(buf, "daq_evtbuild%s", my->shmname); + + if (Worker_getStatistic(buf, "runId", &myRunId) == -1) { fprintf(stderr, " evtbuild.c: getRunId: Worker_getStatistic: cannot get runId!\n"); sleep(1); } else { + t = time(NULL); + dT = t - t0; + if (dT > 2) { + printf("Still waiting for runId from EPICS IOC...\n"); + t0 = t; + } + if (myRunId == 0) nanosleep(&tv, NULL); }