GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisWatchRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisWatchRunnable.cxx 2744 2020-04-16 08:40:37Z linev $
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 fuer 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 "TGo4Thread.h"
17 #include "TGo4Task.h"
18 
19 #include "TGo4AnalysisClientImp.h"
20 #include "TGo4AnalysisImp.h"
21 
23 //const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=50;
24 
26  TGo4Runnable(name,cli->GetTask()), fxAnalysisClient(cli)
27 {
28  fxAnalysis = cli->GetAnalysis();
29 }
30 
32 {
33 
34 }
35 
37 {
38  // check if ratemeter was updated
39  if (fxAnalysis)
40  {
41  static Bool_t initbefore = kFALSE; // JAM15: handle here update of status buffer after close analysis,
42  // now main thread will never SendAnalysisClientStatus at Stop() to avoid deadlocking
43  if (fxAnalysis->IsInitDone() || initbefore)
44  {
45  initbefore = kTRUE;
47  {
48  // no, we have to update it ourselves and fill the status buffer
50  fxAnalysisClient->UpdateRate(0); // update with calculation of time and average rate
51  else
52  fxAnalysisClient->UpdateRate(-1); // stopped: keep latest values for time and average rate
53  {
54  //TGo4LockGuard mainguard; // in UpdateStatusBuffer now JA
55  //std::cout << "watch runnable updated status buffer itself!!!"<< std::endl;
57  } // lock guard
58  }
59  else
60  { // yes, main thread is running on that, we do nothing
61 
62  } // if(!fxAnalysisClient->TestRatemeter())
63 
65  }
66 
67  else
68  {
69  // analysis not yet initialized, no status to update
70  } // if (ana->fbInitIsDone)
71  } //if (fxAnalysis){
73  return 0;
74 }
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:156
void UpdateRate(Int_t counts=1)