CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SubProcess.cc
Go to the documentation of this file.
1 #include "SubProcess.h"
3 
4 namespace evf{
5 
7  {
8  ind_=b.ind_;
9  pid_=b.pid_;
10  alive_=b.alive_;
11  mqm_=b.mqm_;
12  mqs_=b.mqs_;
13  save_nbp_ = b.save_nbp_;
14  save_nba_ = b.save_nba_;
19  return *this;
20  }
21 
23  {
24  mqm_->drain();
25  mqs_->drain();
26  mqs_->disconnect();
27  mqm_->disconnect();
28  save_nbp_ = 0;
29  save_nba_ = 0;
30  save_ndqm_ = 0;
31  save_scalers_ = 0;
32  }
33 
34  void SubProcess::setStatus(int st){
35  alive_ = st;
36  if(alive_ != 1) //i.e. process is no longer alive
37  {
38  //save counters after last update
39  save_nbp_ = prg_.nbp;
40  save_nba_ = prg_.nba;
43  }
44  }
45 
46  void SubProcess::setParams(struct prg *p)
47  {
48  prg_.ls = p->ls;
49  prg_.ps = p->ps;
50  prg_.nbp = p->nbp + save_nbp_;
51  prg_.nba = p->nba + save_nba_;
52  prg_.Ms = p->Ms;
53  prg_.ms = p->ms;
54  prg_.dqm = p->dqm + save_ndqm_;
55  prg_.trp = p->trp + save_scalers_;
56  }
57 
59  {
60  mqm_->drain();
61  mqs_->drain();
62  pid_t retval = -1;
63  retval = fork();
64  reported_inconsistent_ = false;
65  if(retval>0)
66  {
67  pid_ = retval;
68  alive_=1;
69  }
70  if(retval==0)
71  {
72  // freopen(filename,"w",stdout); // send all console output from children to /dev/null
73  freopen("/dev/null","w",stderr);
74  FileDescriptorHandler a; //handle socket file descriptors left open at fork
76  sqs_ = new SlaveQueue(ind_);
77  }
78  return retval;
79  }
80 
81 }
unsigned int ps
Definition: queue_defs.h:56
unsigned int nbp
Definition: queue_defs.h:57
int restart_countdown_
Definition: SubProcess.h:143
unsigned int ls
Definition: queue_defs.h:55
void setStatus(int st)
Definition: SubProcess.cc:34
void setParams(struct prg *p)
Definition: SubProcess.cc:46
boost::shared_ptr< MasterQueue > mqs_
Definition: SubProcess.h:138
static const unsigned int monitor_queue_offset_
Definition: SubProcess.h:131
SlaveQueue * sqs_
Definition: SubProcess.h:140
void disconnect()
Definition: SubProcess.cc:22
unsigned int Ms
Definition: queue_defs.h:59
unsigned int save_scalers_
Definition: SubProcess.h:149
struct prg prg_
Definition: SubProcess.h:142
unsigned int nba
Definition: queue_defs.h:58
SubProcess & operator=(const SubProcess &b)
Definition: SubProcess.cc:6
double b
Definition: hdecay.h:120
SlaveQueue * sqm_
Definition: SubProcess.h:139
double a
Definition: hdecay.h:121
unsigned int trp
Definition: queue_defs.h:62
unsigned int save_ndqm_
Definition: SubProcess.h:148
unsigned int dqm
Definition: queue_defs.h:61
unsigned int ms
Definition: queue_defs.h:60
boost::shared_ptr< MasterQueue > mqm_
Definition: SubProcess.h:137
bool reported_inconsistent_
Definition: SubProcess.h:150