GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4WatchRunnable.cxx
Go to the documentation of this file.
1// $Id$
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
14#include "TGo4WatchRunnable.h"
15
16#include "TGo4Log.h"
17#include "TGo4Thread.h"
18
20
22: TGo4Runnable(name,cli)
23{
24 GO4TRACE((15,"TGo4WatchRunnable::TGo4WatchRunnable(const char *,TGo4ExampleClient *)",__LINE__, __FILE__));
26}
27
29{
30 GO4TRACE((15,"TGo4WatchRunnable::~TGo4WatchRunnable()",__LINE__, __FILE__));
31
32}
33
35{
36 GO4TRACE((12,"TGo4WatchRunnable::Run()",__LINE__, __FILE__));
37 TGo4ClientTask* cli= dynamic_cast<TGo4ClientTask*> (fxManager);
38 if(cli) {
39 cli->UpdateStatusBuffer(); // will create status object and stream it into TBuffer
40 cli->SendStatusBuffer(); // send TBuffer with most recent client status
41 // note: updating and sending of status buffer may be separated
42 // into different threads. Updating acquires main mutex, sending usually
43 // works without main mutex.
44 if(fxApplication) {
45 cli->SendStatusMessage(1, "Application %s of client %s has been watched",
46 fxApplication->GetName(), cli->GetName());
47 // method to pass text messages of priorities 0,1,2
48 // (info, warning, error) to the server. kTRUE means additional local printout
49 }
50 }
51 TGo4Thread::Sleep(fguWATCHINTERVAL); // wait for the next update
52 return 0;
53}
#define GO4TRACE(X)
Definition TGo4Log.h:25
This class controls a client application running in a task which is controlled by another server task...
Example class for a client application; this may be the analysis client later on which keeps the anal...
TGo4ExampleApplication * GetApplication()
TGo4Runnable(const TGo4Runnable &right)
TGo4ThreadManager * fxManager
The threadmanager which is responsible for our thread.
virtual void SendStatusBuffer()
Send internal status buffer to the master(s).
Definition TGo4Task.cxx:263
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Send message string in a status object to the gui.
Definition TGo4Task.cxx:272
void UpdateStatusBuffer()
Create status object and stream it into the status send buffer.
Definition TGo4Task.cxx:308
static void Sleep(UInt_t millisecs)
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termi...
TGo4ExampleApplication * fxApplication
1
static const UInt_t fguWATCHINTERVAL
frequency in ms for the watcher runnable to check the application
Int_t Run(void *) override
The working function which runs in the thread.