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