GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4TestThreadManager.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 "TGo4TestThreadManager.h"
15 
16 #include "TCanvas.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4ThreadHandler.h"
20 #include "TGo4TestRunnable.h"
21 
23  :TGo4ThreadManager(name,kFALSE)
24 {
25  GO4TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager (const char *name) constructor",__LINE__, __FILE__));
26  fxControlRunnable = new TGo4TestRunnable("ControlRunnable",this,1);
27  TGo4TestRunnable* th1run= new TGo4TestRunnable("HistogramMaker1",this,4);
28  TGo4TestRunnable* th2run= new TGo4TestRunnable("HistogramMaker2",this,4);
29  //TGo4TestRunnable* th3run= new TGo4TestRunnable("dummy action 3",this,0);
30  TGo4TestRunnable* th4run= new TGo4TestRunnable("Exceptiontester",this,6);
31  TGo4TestRunnable* th5run= new TGo4TestRunnable("Service thread",this,0);
32 
33  fxWorkHandler->NewThread("First Thread",th1run);
34  fxWorkHandler->NewThread("Second Thread",th2run);
35  fxWorkHandler->NewThread("Third Thread",th5run);
36  fxWorkHandler->NewThread("Fourth Thread",th4run);
38  TGo4Log::Info("thread manager: all threads added to handler");
39 
40  fxCanvas=new TCanvas(GetName(),"TestRunnable",1200,400);
41  fxPad1= new TPad("Pad1","TestRunnablePad",0.02,0.02,0.48,0.83,33);
42  fxPad2= new TPad("Pad2","TestRunnablePad",0.52,0.02,0.98,0.83,33);
43  fxCanvas->cd();
44  TGo4Log::Info("canvas drawn");
45  fxPad1->Draw();
46  fxCanvas->cd();
47  fxPad2->Draw();
48  TGo4Log::Info("pads drawn");
49  fxCanvas->Modified();
50  fxCanvas->Update();
51 
52  Launch();
53 }
54 
56 {
57  GO4TRACE((15,"TGo4TestThreadManager::~TGo4TestThreadManager destructor",__LINE__, __FILE__));
58  delete fxPad1;
59  delete fxPad2;
60  delete fxCanvas;
61 }
62 
64 {
65  GO4TRACE((14,"TGo4TestThreadManager::TestAction",__LINE__, __FILE__));
66  // no test action so far...
67  return 0;
68 }
TGo4ThreadHandler * fxWorkHandler
static void Info(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:294
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
TGo4TestRunnable * fxControlRunnable
#define GO4TRACE(X)
Definition: TGo4Log.h:25
TGo4TestThreadManager(const char *name)