GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisWatchRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisWatchRunnable.cxx 1408 2015-03-09 12:54:35Z adamczew $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
15 
16 #include "TGo4Log.h"
17 #include "TGo4LockGuard.h"
18 #include "TGo4Thread.h"
19 #include "TGo4Task.h"
20 
21 #include "TGo4ClientStatus.h"
22 #include "TGo4AnalysisClientImp.h"
23 #include "TGo4AnalysisImp.h"
24 
25 #include "Riostream.h"
26 
28 //const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=50;
29 
31  TGo4Runnable(name,cli->GetTask()), fxAnalysisClient(cli)
32 {
33  fxAnalysis = cli->GetAnalysis();
34 }
35 
37 {
38 
39 }
40 
42 {
43  // check if ratemeter was updated
44  if (fxAnalysis)
45  {
46  static Bool_t initbefore = kFALSE; // JAM15: handle here update of status buffer after close analysis,
47  // now main thread will never SendAnalysisClientStatus at Stop() to avoid deadlocking
48  if (fxAnalysis->IsInitDone() || initbefore)
49  {
50  initbefore = kTRUE;
52  {
53  // no, we have to update it ourselves and fill the status buffer
55  fxAnalysisClient->UpdateRate(0); // update with calculation of time and average rate
56  else
57  fxAnalysisClient->UpdateRate(-1); // stopped: keep latest values for time and average rate
58  {
59  //TGo4LockGuard mainguard; // in UpdateStatusBuffer now JA
60  //std::cout << "watch runnable updated status buffer itself!!!"<< std::endl;
62  } // lock guard
63  }
64  else
65  { // yes, main thread is running on that, we do nothing
66 
67  } // if(!fxAnalysisClient->TestRatemeter())
68 
70  }
71 
72  else
73  {
74  // analysis not yet initialized, no status to update
75  } // if (ana->fbInitIsDone)
76  } //if (fxAnalysis){
78  return 0;
79 }
Bool_t IsInitDone() const
Bool_t MainIsRunning()
Definition: TGo4Slave.h:92
TGo4AnalysisClient * fxAnalysisClient
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:336
TGo4Analysis * GetAnalysis() const
void UpdateStatusBuffer()
Definition: TGo4Slave.cxx:157
void UpdateRate(Int_t counts=1)