GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4MainRunnable.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 "TGo4MainRunnable.h"
15
16#include "TGo4Log.h"
17#include "TGo4LockGuard.h"
18#include "TGo4Thread.h"
19
20#include "TGo4CommandInvoker.h"
21#include "TGo4LogicException.h"
22
24: TGo4Runnable(name,cli)
25{
26 GO4TRACE((15,"TGo4MainRunnable::TGo4MainRunnable(const char *,TGo4ExampleClient *)",__LINE__, __FILE__));
28}
29
31{
32 GO4TRACE((15,"TGo4MainRunnable::~TGo4MainRunnable()",__LINE__, __FILE__));
33}
34
36{
37 GO4TRACE((12,"TGo4MainRunnable::Run()",__LINE__, __FILE__));
38 // first test: simply wait for command, then execute it and send back an object
39 TGo4ExampleClient* cli= dynamic_cast<TGo4ExampleClient*> (fxManager);
40 if(!cli)
41 throw TGo4LogicException();
42 TGo4Command *com = cli->NextCommand();
43 if (com) {
44 TGo4LockGuard mainlock; // protect command invocation!
45 TGo4CommandInvoker::Instance()->Invoke(com); // execute command by invoker
46 delete com;
47 }
48 // do "main event loop"...
49 fxApplication->FillHistograms();
51 return 0;
52}
#define TGo4LockGuard
#define GO4TRACE(X)
Definition TGo4Log.h:25
static TGo4CommandInvoker * Instance()
virtual void Invoke(TGo4Command *com)
This is the Go4 Abstract Command Class; part of the Base command pattern.
Definition TGo4Command.h:35
Example class for a client application; this may be the analysis client later on which keeps the anal...
TGo4ExampleApplication * GetApplication()
TGo4ExampleApplication * fxApplication
1
Int_t Run(void *) override
The working function which runs in the thread.
TGo4Runnable(const TGo4Runnable &right)
TGo4ThreadManager * fxManager
The threadmanager which is responsible for our thread.
virtual TGo4Command * NextCommand()
Delivers next command from command queue.
Definition TGo4Task.cxx:325
static void Sleep(UInt_t millisecs)
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termi...