CMS 3D CMS Logo

dqm::Updater Class Reference

#include <DQMServices/XdaqCollector/interface/Updater.h>

List of all members.

Public Member Functions

bool checkRunning () const
void registerObserver (dqm::UpdateObserver *)
void request_update ()
void setRunning ()
void setStopped ()
 Updater (DQMOldReceiver *the_mui)
 ~Updater ()

Static Public Member Functions

static voidstart (void *pthis)
 this is the function the thread will execute

Private Types

typedef olist::const_iterator obi
typedef std::list
< dqm::UpdateObserver * > 
olist

Private Attributes

DQMOldReceivermui
olist obs_
bool observed
bool running
pthread_t worker


Detailed Description

Definition at line 12 of file Updater.h.


Member Typedef Documentation

typedef olist::const_iterator dqm::Updater::obi [private]

Definition at line 16 of file Updater.h.

typedef std::list<dqm::UpdateObserver *> dqm::Updater::olist [private]

Definition at line 15 of file Updater.h.


Constructor & Destructor Documentation

Updater::Updater ( DQMOldReceiver the_mui  ) 

Definition at line 7 of file Updater.cc.

References NULL, pthread_create, start(), and worker.

00007                                         : mui(the_mui), observed(false),
00008                                                   running(false)
00009 {
00010   // create a thread and pass a pointer to the static function start
00011   pthread_create(&worker, NULL, start, (void *)this);
00012 }

dqm::Updater::~Updater (  )  [inline]

recommended by Benigno Gobbo to fix crash for following sequence: Configure/Enable/Halt + Configure/Enable

Definition at line 27 of file Updater.h.

References worker.

00028         {
00031           pthread_cancel( worker );
00032         }


Member Function Documentation

bool dqm::Updater::checkRunning (  )  const [inline]

Definition at line 46 of file Updater.h.

References running.

Referenced by start().

00047         {
00048           return running;
00049         }

void Updater::registerObserver ( dqm::UpdateObserver obs  ) 

Definition at line 37 of file Updater.cc.

References obs_, and observed.

00038 {
00039   observed = true;
00040   obs_.push_back(obs);
00041 }

void Updater::request_update (  ) 

Definition at line 29 of file Updater.cc.

References i, mui, obs_, observed, and DQMOldReceiver::update().

Referenced by start().

00030 {
00031   mui->update();
00032   if(observed)
00033     for(obi i = obs_.begin(); i != obs_.end(); i++)
00034       (*i)->onUpdate();
00035 }

void dqm::Updater::setRunning (  )  [inline]

Definition at line 41 of file Updater.h.

References running.

Referenced by start().

00042         { 
00043           running = true; 
00044         }

void dqm::Updater::setStopped (  )  [inline]

Definition at line 51 of file Updater.h.

References running.

Referenced by DQMBaseClient::haltAction().

00052         {
00053           running=false;
00054         }

void * Updater::start ( void pthis  )  [static]

this is the function the thread will execute

Definition at line 14 of file Updater.cc.

References checkRunning(), request_update(), and setRunning().

Referenced by Updater().

00015 {
00016   // We receive a pointer to the parent Updater object
00017   Updater *updater_pt = (Updater *)pthis;
00018   updater_pt->setRunning();
00019   while(1)
00020     {
00021       // call the updater request_update method
00022       updater_pt->request_update();
00023       if(!updater_pt->checkRunning()) break;
00024     }
00025   
00026   return (void *)updater_pt;
00027 }


Member Data Documentation

DQMOldReceiver* dqm::Updater::mui [private]

Definition at line 18 of file Updater.h.

Referenced by request_update().

olist dqm::Updater::obs_ [private]

Definition at line 19 of file Updater.h.

Referenced by registerObserver(), and request_update().

bool dqm::Updater::observed [private]

Definition at line 20 of file Updater.h.

Referenced by registerObserver(), and request_update().

bool dqm::Updater::running [private]

Definition at line 21 of file Updater.h.

Referenced by checkRunning(), setRunning(), and setStopped().

pthread_t dqm::Updater::worker [private]

Definition at line 17 of file Updater.h.

Referenced by Updater(), and ~Updater().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:37:16 2009 for CMSSW by  doxygen 1.5.4