Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  01 Dec 2017, Frederik Wauters, Bug Report, small bug in mfe.c init 
    Reply  01 Dec 2017, Stefan Ritt, Bug Report, small bug in mfe.c init 
       Reply  04 Dec 2017, Frederik Wauters, Bug Report, small bug in mfe.c init 
          Reply  04 Dec 2017, Stefan Ritt, Bug Report, small bug in mfe.c init 
Message ID: 1334     Entry time: 04 Dec 2017     In reply to: 1333
Author: Stefan Ritt 
Topic: Bug Report 
Subject: small bug in mfe.c init 
> Thanks, I misunderstood the loop then. If poll_event(equipment[idx].info.source, (INT)count, TRUE); doesn`t do anything with "count", the loop becomes infinite except for the overflow 
> check. 

Well, the function poll_event() is _supposed_ to use "count" in a for loop as written in the example frontend:

   for (i = 0; i < count; i++) {
      /* poll hardware and set flag to TRUE if new event is available */
      flag = TRUE;

      if (flag)
         if (!test)
            return TRUE;
   }

where "flag = TRUE" must be replaced with the proper hardware check. This can be a VME access, a network TCP exchange with some Ethernet based hardware, or even a mutex check if the events are collected by a 
separate thread in the frontend.

The idea of having the for (i=0 ; i<count ; i++) loop _inside_ the poll_event() function and not outside is the fact that each function call to poll_event() takes time, and we want the minimal possible response time to new 
events. It might be just a micro-second, but having an experiment running at 100 Hz for one year (like Mu3e), this adds up to about one hour per year, which is a considerable amount of precious beam time.

Stefan
ELOG V3.1.4-2e1708b5