Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
om::OnMonProdIPC Class Reference
Inheritance diagram for om::OnMonProdIPC:
om::IPC

Public Member Functions

 OnMonProdIPC (int m, const char *hdl)
 
int HandleRequests ()
 
void PostResources (unsigned int run, unsigned int subrun, unsigned int event)
 
TH1F * RequestTH1F (const char *n)
 
TH2F * RequestTH2F (const char *n)
 
int RequestHistoList (std::list< std::string > &hlist)
 
int RequestCurrentWatchList (std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
 
int RequestAddToWatchList (int db, int dcm, int feb, int pix)
 
int RequestRemoveFromWatchList (int db, int dcm, int feb, int pix)
 
void ResetAllLocks ()
 

Public Attributes

int fMode
 Client or server? More...
 
int fShmId
 ID of shared memory segment. More...
 
key_t * fKey
 Shared memory key. More...
 
char fShmHdl [kHdlSz]
 Shared memory handle. More...
 
voidfShm
 Pointer to shared segment. More...
 
struct IPCBlockfIPC
 Pointer to struct. More...
 

Static Public Attributes

static const int kHdlSz = sizeof(key_t)+1
 

Private Member Functions

TH1F * FindTH1F (const char *nm)
 
TH2F * FindTH2F (const char *nm)
 
void HistoList (std::list< std::string > &hlist)
 
void AddToWatchList (int db, int dcm, int feb, int pix)
 
void RemoveFromWatchList (int db, int dcm, int feb, int pix)
 
void CurrentWatchList (std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
 

Detailed Description

A class that knows how to serve monitoring histograms

Definition at line 48 of file OnMonProd_module.cc.

Constructor & Destructor Documentation

OnMonProdIPC::OnMonProdIPC ( int  m,
const char *  hdl 
)

Definition at line 119 of file OnMonProd_module.cc.

119 : om::IPC(m, hdl) { }
Definition: IPC.h:29

Member Function Documentation

void OnMonProdIPC::AddToWatchList ( int  db,
int  dcm,
int  feb,
int  pix 
)
privatevirtual

Reimplemented from om::IPC.

Definition at line 129 of file OnMonProd_module.cc.

References om::WatchListManager::Add(), and om::WatchListManager::Instance().

129  {
131 }
void Add(int db, int dcm, int feb, int pix)
static WatchListManager & Instance()
void OnMonProdIPC::CurrentWatchList ( std::vector< int > &  db,
std::vector< int > &  dcm,
std::vector< int > &  feb,
std::vector< int > &  pix 
)
privatevirtual

Reimplemented from om::IPC.

Definition at line 135 of file OnMonProd_module.cc.

References om::WatchListManager::GetList(), and om::WatchListManager::Instance().

138  {
140 }
void GetList(std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
static WatchListManager & Instance()
TH1F * OnMonProdIPC::FindTH1F ( const char *  nm)
privatevirtual

Reimplemented from om::IPC.

Definition at line 120 of file OnMonProd_module.cc.

References om::HistoSet::FindTH1F(), and om::HistoSet::Instance().

120  {
121  return HistoSet::Instance().FindTH1F(nm);
122 }
TH1F * FindTH1F(const char *nm)
Definition: HistoSet.cxx:50
static constexpr Double_t nm
Definition: Munits.h:133
static HistoSet & Instance()
Definition: HistoSet.cxx:24
TH2F * OnMonProdIPC::FindTH2F ( const char *  nm)
privatevirtual

Reimplemented from om::IPC.

Definition at line 123 of file OnMonProd_module.cc.

References om::HistoSet::FindTH2F(), and om::HistoSet::Instance().

123  {
124  return HistoSet::Instance().FindTH2F(nm);
125 }
static constexpr Double_t nm
Definition: Munits.h:133
TH2F * FindTH2F(const char *nm)
Definition: HistoSet.cxx:59
static HistoSet & Instance()
Definition: HistoSet.cxx:24
int IPC::HandleRequests ( )
inherited

Method for server application check to see if there are any requests pending

Definition at line 516 of file IPC.cxx.

References om::IPC::HandleChangeWatchList(), om::IPC::HandleCurrentWatchListRequests(), om::IPC::HandleHistogramRequests(), and om::IPC::HandleHistoListRequests().

Referenced by om::OnMonProd::analyze().

517 {
518  int ok1 = this->HandleHistogramRequests();
519  int ok2 = this->HandleHistoListRequests();
520  int ok3 = this->HandleChangeWatchList();
521  int ok4 = this->HandleCurrentWatchListRequests();
522  if (ok1==1 && ok2==1 && ok3==1 && ok4==1) return 1;
523  return 0;
524 }
int HandleHistoListRequests()
Definition: IPC.cxx:596
int HandleHistogramRequests()
Definition: IPC.cxx:550
int HandleCurrentWatchListRequests()
Definition: IPC.cxx:673
int HandleChangeWatchList()
Definition: IPC.cxx:637
void OnMonProdIPC::HistoList ( std::list< std::string > &  hlist)
privatevirtual

Reimplemented from om::IPC.

Definition at line 126 of file OnMonProd_module.cc.

References om::HistoSet::GetNames(), and om::HistoSet::Instance().

126  {
127  HistoSet::Instance().GetNames(hlist);
128 }
static HistoSet & Instance()
Definition: HistoSet.cxx:24
void GetNames(std::list< std::string > &h)
Definition: HistoSet.cxx:111
void IPC::PostResources ( unsigned int  run,
unsigned int  subrun,
unsigned int  event 
)
inherited

Post information about producer resource usage

Definition at line 528 of file IPC.cxx.

References om::ProducerResources::fCLOCK, om::ProducerResources::fCPU, om::ProducerResources::fEvent, om::IPC::fIPC, om::ProducerResources::fPID, om::IPCBlock::fProcessResources, om::ProducerResources::fRSIZE, om::ProducerResources::fRun, om::ProducerResources::fSTIME, om::ProducerResources::fSubrun, om::ProducerResources::fUTIME, updateRunHistoryTables::run, and getGoodRuns4SAM::subrun.

Referenced by om::OnMonProd::analyze().

531 {
534  fIPC->fProcessResources.fEvent = event;
535 
536  struct rusage r;
537  getrusage(RUSAGE_SELF, &r);
538 
539  fIPC->fProcessResources.fPID = getpid();
540  fIPC->fProcessResources.fSTIME = r.ru_stime.tv_sec;
541  fIPC->fProcessResources.fUTIME = r.ru_utime.tv_sec;
543  fIPC->fProcessResources.fRSIZE = r.ru_maxrss;
545 
546 }
unsigned int fSubrun
Subrun number of last update.
Definition: IPCBlock.h:39
long fSTIME
System time.
Definition: IPCBlock.h:42
time_t fCLOCK
Time of update.
Definition: IPCBlock.h:46
long fCPU
Process CPU usage.
Definition: IPCBlock.h:44
long fRSIZE
Process size.
Definition: IPCBlock.h:45
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
pid_t fPID
Process ID.
Definition: IPCBlock.h:41
unsigned int fRun
Run number of last update.
Definition: IPCBlock.h:38
unsigned int fEvent
Event number of last update.
Definition: IPCBlock.h:40
TRandom3 r(0)
long fUTIME
User time.
Definition: IPCBlock.h:43
ProducerResources fProcessResources
Definition: IPCBlock.h:131
void OnMonProdIPC::RemoveFromWatchList ( int  db,
int  dcm,
int  feb,
int  pix 
)
privatevirtual

Reimplemented from om::IPC.

Definition at line 132 of file OnMonProd_module.cc.

References om::WatchListManager::Instance(), and om::WatchListManager::Remove().

132  {
134 }
void Remove(int db, int dcm, int feb, int pix)
static WatchListManager & Instance()
int IPC::RequestAddToWatchList ( int  db,
int  dcm,
int  feb,
int  pix 
)
inherited

Client tells server to add item to the watchlist db, dcm, feb, pix = hardware to be added

Parameters
sel= selected item to be removed
Returns
1 if aok

Definition at line 346 of file IPC.cxx.

References om::cerr, febshutoff_auto::db, febshutoff_auto::dcm, allTimeWatchdog::endl, om::ChangeWatchList::fAddOrRemove, om::IPCBlock::fChangeWatchList, om::ChangeWatchList::fClientLock, om::ChangeWatchList::fDB, om::ChangeWatchList::fDCM, APDHVSetting::feb, om::ChangeWatchList::fFEB, om::IPC::fIPC, om::IPC::fMode, om::ChangeWatchList::fPIX, om::ChangeWatchList::fRequestPending, om::ChangeWatchList::fServerLock, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, and kWait.

Referenced by om::WatchListBox::HandleAddToList().

347 {
348  // only the clients can request changes to the watchlist
349  if (fMode==kIPC_SERVER) {
350  std::cerr << __FILE__ << ":" << __LINE__
351  << " Server used as client." << std::endl;
352  abort();
353  }
354 
355  //
356  // Wait for any locks to clear then set our own client lock
357  //
358  unsigned int i;
359  for (i=0; i<kWait; ++i) {
360  if ( (fIPC->fChangeWatchList.fClientLock == 0) &&
362  (fIPC->fChangeWatchList.fRequestPending == 0) ) break;
363  usleep(kSleep);
364  }
365  if (i==kWait) {
366  std::cerr << __FILE__ << ":" << __LINE__
367  << " Time out waiting for client lock, server "
368  << "lock, and pending requests."
369  << std::endl;
370  return 0;
371  }
372 
378  fIPC->fChangeWatchList.fPIX = pix;
379 
380  //
381  // Submit a request to the server and wait for a response
382  //
384  for (i=0; i<kWait; ++i) {
385  if (fIPC->fChangeWatchList.fRequestPending==0) break;
386  usleep(kSleep);
387  }
388  if (i==kWait) {
389  std::cerr << __FILE__ << ":" << __LINE__
390  << " Time out waiting for request to be satisfied."
391  << std::endl;
393  return 0;
394  }
395 
397  return 1;
398 }
int fMode
Client or server?
Definition: IPC.h:146
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:111
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
ChangeWatchList fChangeWatchList
Definition: IPCBlock.h:134
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:112
static const int kIPC_SERVER
Definition: IPC.h:23
int fFEB
Front end board identifier.
Definition: IPCBlock.h:117
int fDB
Diblock identifier.
Definition: IPCBlock.h:115
int fAddOrRemove
Add this channel / remove this channel.
Definition: IPCBlock.h:114
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:113
int fDCM
DCM identifier.
Definition: IPCBlock.h:116
int fPIX
Pixel identifier.
Definition: IPCBlock.h:118
static const unsigned int kWait
Definition: IPC.cxx:22
static const unsigned int kSleep
Definition: IPC.cxx:21
int IPC::RequestCurrentWatchList ( std::vector< int > &  db,
std::vector< int > &  dcm,
std::vector< int > &  feb,
std::vector< int > &  pix 
)
inherited

Client call to request the current watchlist

Definition at line 284 of file IPC.cxx.

References om::cerr, allTimeWatchdog::endl, om::WatchList::fClientLock, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::IPC::fIPC, om::IPC::fMode, om::WatchList::fN, om::WatchList::fPIX, om::WatchList::fRequestPending, om::WatchList::fServerLock, om::IPCBlock::fWatchList, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, and kWait.

288 {
289  if (fMode==kIPC_SERVER) {
290  std::cerr << __FILE__ << ":" << __LINE__
291  << " Server used as client." << std::endl;
292  abort();
293  }
294 
295  //
296  // Wait for any locks to clear then set our own client lock
297  //
298  unsigned int i;
299  for (i=0; i<kWait; ++i) {
300  if ( (fIPC->fWatchList.fClientLock ==0) &&
301  (fIPC->fWatchList.fServerLock ==0) &&
302  (fIPC->fWatchList.fRequestPending==0)) break;
303  usleep(kSleep);
304  }
305  if (i==kWait) {
306  std::cerr << __FILE__ << ":" << __LINE__
307  << " Time out waiting for client lock, server "
308  << "lock, and pending requests."
309  << std::endl;
310  return 0;
311  }
312 
316 
317  for (i=0; i<kWait; ++i) {
318  if (fIPC->fWatchList.fRequestPending==0) break;
319  usleep(kSleep);
320  }
321  if (i==kWait) {
322  std::cerr << __FILE__ << ":" << __LINE__
323  << " Time out waiting for request to be satisfied."
324  << std::endl;
326  return 0;
327  }
328 
329  //
330  // With the request satisfied by the server, fill the list
331  //
333  for(i=0; i<fIPC->fWatchList.fN; ++i) {
334  db .push_back(fIPC->fWatchList.fDB [i]);
335  dcm.push_back(fIPC->fWatchList.fDCM[i]);
336  feb.push_back(fIPC->fWatchList.fFEB[i]);
337  pix.push_back(fIPC->fWatchList.fPIX[i]);
338  }
340 
341  return 1;
342 }
std::vector< int > fDCM
int fMode
Client or server?
Definition: IPC.h:146
char fClientLock
Definition: IPCBlock.h:71
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
WatchList fWatchList
Definition: IPCBlock.h:135
static const int kIPC_SERVER
Definition: IPC.h:23
char fServerLock
Definition: IPCBlock.h:72
std::vector< int > fPIX
std::vector< int > fDB
char fRequestPending
Definition: IPCBlock.h:73
unsigned int fN
Definition: IPCBlock.h:74
static const unsigned int kWait
Definition: IPC.cxx:22
static const unsigned int kSleep
Definition: IPC.cxx:21
std::vector< int > fFEB
int IPC::RequestHistoList ( std::list< std::string > &  hlist)
inherited

Client call to request the histogram list

Definition at line 225 of file IPC.cxx.

References om::cerr, allTimeWatchdog::endl, om::HistogramList::fClientLock, om::IPCBlock::fHistoList, om::IPC::fIPC, om::IPC::fMode, om::HistogramList::fN, om::HistogramList::fName, om::HistogramList::fRequestPending, om::HistogramList::fServerLock, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, and kWait.

Referenced by om::HistoSHM::GetHistogramList().

226 {
227  if (fMode==kIPC_SERVER) {
228  std::cerr << __FILE__ << ":" << __LINE__
229  << " Server used as client." << std::endl;
230  abort();
231  }
232 
233  //
234  // Wait for any locks to clear then set our own client lock
235  //
236  unsigned int i;
237  for (i=0; i<kWait; ++i) {
238  if ( (fIPC->fHistoList.fClientLock ==0) &&
239  (fIPC->fHistoList.fServerLock ==0) &&
240  (fIPC->fHistoList.fRequestPending==0)) break;
241  usleep(kSleep);
242  }
243  if (i==kWait) {
244  std::cerr << __FILE__ << ":" << __LINE__
245  << " Time out waiting for client lock, server "
246  << "lock, and pending requests."
247  << std::endl;
248  return 0;
249  }
250 
254 
255  for (i=0; i<kWait; ++i) {
256  if (fIPC->fHistoList.fRequestPending==0) break;
257  usleep(kSleep);
258  }
259  if (i==kWait) {
260  std::cerr << __FILE__ << ":" << __LINE__
261  << " Time out waiting for request to be satisfied."
262  << std::endl;
264  return 0;
265  }
266 
267  //
268  // With the request satisfied by the server, fill the list
269  //
271  for (i=0; i<fIPC->fHistoList.fN; ++i) {
272  hlist.push_back(fIPC->fHistoList.fName[i]);
273  }
275 
276  return 1;
277 }
int fMode
Client or server?
Definition: IPC.h:146
unsigned int fN
Definition: IPCBlock.h:59
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
static const int kIPC_SERVER
Definition: IPC.h:23
HistogramList fHistoList
Definition: IPCBlock.h:132
char fRequestPending
Definition: IPCBlock.h:58
static const unsigned int kWait
Definition: IPC.cxx:22
char fName[NMAX_HISTOS][HISTO_NAME_SZ]
Definition: IPCBlock.h:60
static const unsigned int kSleep
Definition: IPC.cxx:21
int IPC::RequestRemoveFromWatchList ( int  db,
int  dcm,
int  feb,
int  pix 
)
inherited

Definition at line 402 of file IPC.cxx.

References om::cerr, febshutoff_auto::db, febshutoff_auto::dcm, allTimeWatchdog::endl, om::ChangeWatchList::fAddOrRemove, om::IPCBlock::fChangeWatchList, om::ChangeWatchList::fClientLock, om::ChangeWatchList::fDB, om::ChangeWatchList::fDCM, APDHVSetting::feb, om::ChangeWatchList::fFEB, om::IPC::fIPC, om::IPC::fMode, om::ChangeWatchList::fPIX, om::ChangeWatchList::fRequestPending, om::ChangeWatchList::fServerLock, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, and kWait.

403 {
404  // only the clients can request changes to the watchlist
405  if (fMode==kIPC_SERVER) {
406  std::cerr << __FILE__ << ":" << __LINE__
407  << " Server used as client." << std::endl;
408  abort();
409  }
410 
411  //
412  // Wait for any locks to clear then set our own client lock
413  //
414  unsigned int i;
415  for (i=0; i<kWait; ++i) {
416  if ( (fIPC->fChangeWatchList.fClientLock == 0) &&
418  (fIPC->fChangeWatchList.fRequestPending == 0) ) break;
419  usleep(kSleep);
420  }
421  if (i==kWait) {
422  std::cerr << __FILE__ << ":" << __LINE__
423  << " Time out waiting for client lock, server "
424  << "lock, and pending requests."
425  << std::endl;
426  return 0;
427  }
428 
434  fIPC->fChangeWatchList.fPIX = pix;
435 
436  //
437  // Submit a request to the server and wait for a response
438  //
440  for (i=0; i<kWait; ++i) {
441  if (fIPC->fChangeWatchList.fRequestPending==0) break;
442  usleep(kSleep);
443  }
444  if (i==kWait) {
445  std::cerr << __FILE__ << ":" << __LINE__
446  << " Time out waiting for request to be satisfied."
447  << std::endl;
449  return 0;
450  }
451 
453  return 1;
454 }
int fMode
Client or server?
Definition: IPC.h:146
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:111
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
ChangeWatchList fChangeWatchList
Definition: IPCBlock.h:134
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:112
static const int kIPC_SERVER
Definition: IPC.h:23
int fFEB
Front end board identifier.
Definition: IPCBlock.h:117
int fDB
Diblock identifier.
Definition: IPCBlock.h:115
int fAddOrRemove
Add this channel / remove this channel.
Definition: IPCBlock.h:114
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:113
int fDCM
DCM identifier.
Definition: IPCBlock.h:116
int fPIX
Pixel identifier.
Definition: IPCBlock.h:118
static const unsigned int kWait
Definition: IPC.cxx:22
static const unsigned int kSleep
Definition: IPC.cxx:21
TH1F * IPC::RequestTH1F ( const char *  n)
inherited

Client calls to request a histogram from the server.

Parameters
n- name of histogram to retrieve
Returns
A new histogram. Called takes ownership

Definition at line 109 of file IPC.cxx.

References om::cerr, allTimeWatchdog::endl, om::ProducerHistogram::fClientLock, om::IPCBlock::fHistogram, om::IPC::fIPC, om::IPC::fMode, om::ProducerHistogram::fRequestPending, om::ProducerHistogram::fServerLock, make_syst_table_plots::h, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, kWait, om::IPC::Request(), and om::IPC::UnpackTH1F().

Referenced by om::HistoSHM::GetTH1FCopy().

110 {
111  if (fMode==kIPC_SERVER) {
112  std::cerr << __FILE__ << ":" << __LINE__
113  << " Server used as client." << std::endl;
114  abort();
115  }
116 
117  //
118  // Wait for any locks to clear then set our own client lock
119  //
120  unsigned int i;
121  for (i=0; i<kWait; ++i) {
122  if ( (fIPC->fHistogram.fClientLock ==0) &&
123  (fIPC->fHistogram.fServerLock ==0) &&
124  (fIPC->fHistogram.fRequestPending==0)) break;
125  usleep(kSleep);
126  }
127  if (i==kWait) {
128  std::cerr << __FILE__ << ":" << __LINE__
129  << " Time out waiting for client lock, server lock, "
130  << "and pending requests. " << std::endl;
131  return 0;
132  }
133 
135 
136  //
137  // Submit a request to the server and wait for a response
138  //
139  this->Request(n, "TH1F");
140  for (i=0; i<kWait; ++i) {
141  if (fIPC->fHistogram.fRequestPending==0) break;
142  usleep(kSleep);
143  }
144  if (i==kWait) {
145  std::cerr << __FILE__ << ":" << __LINE__
146  << " Time out waiting for request to be satisfied."
147  << std::endl;
149  return 0;
150  }
151 
152  //
153  // With the request satisfied by the server, make a TH1F for
154  // return. Now that we are done with the data in the shared memory
155  // segment, release the lock we have on it.
156  //
157  TH1F* h = this->UnpackTH1F();
159 
160  return h;
161 }
int fMode
Client or server?
Definition: IPC.h:146
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:91
static const int kIPC_SERVER
Definition: IPC.h:23
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:89
ProducerHistogram fHistogram
Definition: IPCBlock.h:133
std::void_t< T > n
TH1F * UnpackTH1F()
Definition: IPC.cxx:458
static const unsigned int kWait
Definition: IPC.cxx:22
static const unsigned int kSleep
Definition: IPC.cxx:21
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:90
int Request(const char *n, const char *t)
Definition: IPC.cxx:506
TH2F * IPC::RequestTH2F ( const char *  n)
inherited

Definition at line 165 of file IPC.cxx.

References om::cerr, allTimeWatchdog::endl, om::ProducerHistogram::fClientLock, om::IPCBlock::fHistogram, om::IPC::fIPC, om::IPC::fMode, om::ProducerHistogram::fRequestPending, om::ProducerHistogram::fServerLock, make_syst_table_plots::h, MECModelEnuComparisons::i, om::kIPC_SERVER, kSleep, kWait, om::IPC::Request(), and om::IPC::UnpackTH2F().

Referenced by om::HistoSHM::GetTH2FCopy().

166 {
167  if (fMode==kIPC_SERVER) {
168  std::cerr << __FILE__ << ":" << __LINE__
169  << " Server used as client." << std::endl;
170  abort();
171  }
172 
173  //
174  // Wait for any locks to clear then set our own client lock
175  //
176  unsigned int i;
177  for (i=0; i<kWait; ++i) {
178  if ( (fIPC->fHistogram.fClientLock ==0) &&
179  (fIPC->fHistogram.fServerLock ==0) &&
180  (fIPC->fHistogram.fRequestPending==0)) break;
181  usleep(kSleep);
182  }
183  if (i==kWait) {
184  std::cerr << __FILE__ << ":" << __LINE__
185  << " Time out waiting for client lock, server lock, "
186  << "and pending requests. "
187  << std::endl;
188  return 0;
189  }
190 
192 
193  //
194  // Submit a request to the server and wait for a response
195  //
196  this->Request(n, "TH2F");
197  for (i=0; i<kWait; ++i) {
198  if (fIPC->fHistogram.fRequestPending==0) break;
199  usleep(kSleep);
200  }
201  if (i==kWait) {
202  std::cerr << __FILE__ << ":" << __LINE__
203  << " Time out waiting for request to be satisfied."
204  << std::endl;
206  return 0;
207  }
208 
209  //
210  // With the request satisfied by the server, make a TH1F for
211  // return. Now that we are done with the data in the shared memory
212  // segment, release the lock we have on it.
213  //
214  TH2F* h = this->UnpackTH2F();
216 
217  return h;
218 }
int fMode
Client or server?
Definition: IPC.h:146
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
OStream cerr
Definition: OStream.cxx:7
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:91
static const int kIPC_SERVER
Definition: IPC.h:23
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:89
TH2F * UnpackTH2F()
Definition: IPC.cxx:479
ProducerHistogram fHistogram
Definition: IPCBlock.h:133
std::void_t< T > n
static const unsigned int kWait
Definition: IPC.cxx:22
static const unsigned int kSleep
Definition: IPC.cxx:21
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:90
int Request(const char *n, const char *t)
Definition: IPC.cxx:506
void IPC::ResetAllLocks ( )
inherited

For "emergency use" only. Clear all locks in the event they get stuck.

Definition at line 843 of file IPC.cxx.

References om::IPCBlock::fChangeWatchList, om::HistogramList::fClientLock, om::WatchList::fClientLock, om::ProducerHistogram::fClientLock, om::ChangeWatchList::fClientLock, om::IPCBlock::fHistogram, om::IPCBlock::fHistoList, om::ProducerHistogram::fHistoOK, om::IPC::fIPC, om::HistogramList::fRequestPending, om::WatchList::fRequestPending, om::ProducerHistogram::fRequestPending, om::ChangeWatchList::fRequestPending, om::HistogramList::fServerLock, om::WatchList::fServerLock, om::ProducerHistogram::fServerLock, om::ChangeWatchList::fServerLock, and om::IPCBlock::fWatchList.

Referenced by om::MenuBar::ResetLocks().

844 {
848 
852  fIPC->fHistogram.fHistoOK = 0;
853 
857 
861 }
char fClientLock
Definition: IPCBlock.h:71
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:111
struct IPCBlock * fIPC
Pointer to struct.
Definition: IPC.h:151
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:91
ChangeWatchList fChangeWatchList
Definition: IPCBlock.h:134
WatchList fWatchList
Definition: IPCBlock.h:135
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:112
char fClientLock
Is access locked by the server?
Definition: IPCBlock.h:89
ProducerHistogram fHistogram
Definition: IPCBlock.h:133
char fServerLock
Definition: IPCBlock.h:72
char fHistoOK
Is the published histogram info OK?
Definition: IPCBlock.h:92
char fRequestPending
Is there a request pending?
Definition: IPCBlock.h:113
HistogramList fHistoList
Definition: IPCBlock.h:132
char fRequestPending
Definition: IPCBlock.h:73
char fRequestPending
Definition: IPCBlock.h:58
char fServerLock
Is access locked by the client?
Definition: IPCBlock.h:90

Member Data Documentation

struct IPCBlock* om::IPC::fIPC
inherited
key_t* om::IPC::fKey
inherited

Shared memory key.

Definition at line 148 of file IPC.h.

Referenced by om::IPC::IPC().

int om::IPC::fMode
inherited
void* om::IPC::fShm
inherited

Pointer to shared segment.

Definition at line 150 of file IPC.h.

Referenced by om::IPC::IPC(), and om::IPC::~IPC().

char om::IPC::fShmHdl[kHdlSz]
inherited

Shared memory handle.

Definition at line 149 of file IPC.h.

Referenced by om::HistoSHM::GetStatus(), and om::IPC::IPC().

int om::IPC::fShmId
inherited

ID of shared memory segment.

Definition at line 147 of file IPC.h.

Referenced by om::IPC::IPC(), and om::IPC::~IPC().

const int om::IPC::kHdlSz = sizeof(key_t)+1
staticinherited

Definition at line 145 of file IPC.h.

Referenced by om::IPC::IPC().


The documentation for this class was generated from the following file: