00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4TestThreadManager.h"
00015
00016 #include "TGo4Log.h"
00017 #include "TGo4ThreadHandler.h"
00018 #include "TGo4TestRunnable.h"
00019
00020 TGo4TestThreadManager::TGo4TestThreadManager(const TGo4TestThreadManager &right)
00021 :TGo4ThreadManager(right)
00022 {
00023 GO4TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager copy ctor",__LINE__, __FILE__));
00024 }
00025
00026 TGo4TestThreadManager::TGo4TestThreadManager (const char* name)
00027 :TGo4ThreadManager(name,kFALSE)
00028 {
00029 GO4TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager (const char* name) constructor",__LINE__, __FILE__));
00030 fxControlRunnable=new TGo4TestRunnable("ControlRunnable",this,1);
00031 TGo4TestRunnable* th1run= new TGo4TestRunnable("HistogramMaker1",this,4);
00032 TGo4TestRunnable* th2run= new TGo4TestRunnable("HistogramMaker2",this,4);
00033
00034 TGo4TestRunnable* th4run= new TGo4TestRunnable("Exceptiontester",this,6);
00035 TGo4TestRunnable* th5run= new TGo4TestRunnable("Service thread",this,0);
00036
00037 fxWorkHandler->NewThread("First Thread",th1run);
00038 fxWorkHandler->NewThread("Second Thread",th2run);
00039 fxWorkHandler->NewThread("Third Thread",th5run);
00040 fxWorkHandler->NewThread("Fourth Thread",th4run);
00041 fxWorkHandler->NewThread("Control",fxControlRunnable);
00042 TGo4Log::Info("thread manager: all threads added to handler");
00043
00044 fxCanvas=new TCanvas(GetName(),"TestRunnable",1200,400);
00045 fxPad1= new TPad("Pad1","TestRunnablePad",0.02,0.02,0.48,0.83,33);
00046 fxPad2= new TPad("Pad2","TestRunnablePad",0.52,0.02,0.98,0.83,33);
00047 fxCanvas->cd();
00048 TGo4Log::Info("canvas drawn");
00049 fxPad1->Draw();
00050 fxCanvas->cd();
00051 fxPad2->Draw();
00052 TGo4Log::Info("pads drawn");
00053 fxCanvas->Modified();
00054 fxCanvas->Update();
00055
00056 Launch();
00057 }
00058
00059 TGo4TestThreadManager::~TGo4TestThreadManager()
00060 {
00061 GO4TRACE((15,"TGo4TestThreadManager::~TGo4TestThreadManager destructor",__LINE__, __FILE__));
00062 delete fxPad1;
00063 delete fxPad2;
00064 delete fxCanvas;
00065 }
00066
00067 Int_t TGo4TestThreadManager::TestAction ()
00068 {
00069 GO4TRACE((14,"TGo4TestThreadManager::TestAction",__LINE__, __FILE__));
00070
00071 return 0;
00072 }
00073
00074 TCanvas* TGo4TestThreadManager::GetCanvas ()
00075 {
00076 GO4TRACE((12,"TGo4TestThreadManager::GetCanvas",__LINE__, __FILE__));
00077 return fxCanvas;
00078 }
00079
00080 TPad* TGo4TestThreadManager::GetPad1 ()
00081 {
00082 GO4TRACE((12,"TGo4TestThreadManager::GetPad1",__LINE__, __FILE__));
00083 return fxPad1;
00084 }
00085
00086 TPad* TGo4TestThreadManager::GetPad2 ()
00087 {
00088 GO4TRACE((12,"TGo4TestThreadManager::GetPad2",__LINE__, __FILE__));
00089 return fxPad2;
00090 }