Belle II Software  release-08-01-10
ProcessListener.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include "daq/slc/readout/ProcessListener.h"
9 #include "daq/slc/readout/ProcessController.h"
10 
11 #include <daq/slc/runcontrol/RCCallback.h>
12 
13 #include <daq/slc/system/LogFile.h>
14 #include <daq/slc/system/Process.h>
15 
16 using namespace Belle2;
17 
18 void ProcessListener::run()
19 {
20  Process& process(m_con->getProcess());
21  std::string process_name = m_con->getParName();
22  RCCallback& callback(*(m_con->getCallback()));
23  if (not process.wait()) {
24  callback.log(LogFile::FATAL, "Failed to wait processed process %s",
25  process_name.c_str());
26  return;
27  }
28  callback.log(LogFile::DEBUG, process_name + " : termineted");
29  callback.log(LogFile::DEBUG, "%s : waitpid_returned %d status = %d", process_name.c_str(), process.waitpid_result(),
30  process.waitpid_status());
31  process.set_id(-1);
32  callback.set(m_con->getParName() + ".pid", -1);
33  /*
34  try {
35  callback.monitor();
36  } catch (const RCHandlerFatalException& e) {
37  callback.log(LogFile::FATAL, e.what());
38  } catch (const RCHandlerException& e) {
39  callback.log(LogFile::ERROR, e.what());
40  } catch (const std::exception& e) {
41  callback.log(LogFile::FATAL, "Unknown exception: %s. terminating process", e.what());
42  }
43  */
44 }
Abstract base class for different kinds of events.