00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4Runnable.h"
00015
00016 #include "TThread.h"
00017
00018 #include "TGo4Log.h"
00019 #include "TGo4Thread.h"
00020 #include "TGo4ThreadManager.h"
00021
00022 TGo4Runnable::TGo4Runnable() :
00023 TNamed(),
00024 fxManager(0),
00025 fxGo4Thread(0)
00026 {
00027 }
00028
00029 TGo4Runnable::TGo4Runnable(const TGo4Runnable &right) :
00030 TNamed(right),
00031 fxManager(right.fxManager),
00032 fxGo4Thread(right.fxGo4Thread)
00033 {
00034 TRACE((14,"TGo4Runnable::TGo4Runnable() copy constructor",__LINE__, __FILE__));
00035 }
00036
00037 TGo4Runnable::TGo4Runnable (const char* name, TGo4ThreadManager* man) :
00038 TNamed(name,"This is a TGo4Runnable"), fxGo4Thread(0)
00039 {
00040 TRACE((14,"TGo4Runnable::TGo4Runnable(const char*,TGo4ThreadManager*) constructor",__LINE__, __FILE__));
00041 fxManager=man;
00042 }
00043
00044 TGo4Runnable::~TGo4Runnable()
00045 {
00046 TRACE((14,"TGo4Runnable::~TGo4Runnable() destructor",__LINE__, __FILE__));
00047 }
00048
00049 void TGo4Runnable::ThreadCatch (TGo4Exception& ex)
00050 {
00051 TRACE((12,"TGo4Runnable::ThreadCatch()",__LINE__, __FILE__));
00052
00053 TGo4Log::Debug("\n %s occured in Runnable``%s''(Thread``%s''PID:%d) \n",
00054 ex.What(),GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
00055 ex.Handle();
00056 }
00057
00058 void TGo4Runnable::UnexpectedCatch ()
00059 {
00060 TRACE((12,"TGo4Runnable::UnexpectedCatch()",__LINE__, __FILE__));
00061
00062 TGo4Log::Debug("!!!-- Unexpected Exception --!!! occured in Runnable``%s''(Thread``%s''PID:%d) ",
00063 GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
00064 fxManager->Terminate();
00065 TThread::CancelPoint();
00066
00067 }
00068
00069 Int_t TGo4Runnable::PreRun (void* arg)
00070 {
00071 TRACE((12,"TGo4Runnable::PreRun()",__LINE__, __FILE__));
00072
00073 TGo4Log::Debug("Executing Runnable default PreRun Method \n");
00074 return 0;
00075 }
00076
00077 Int_t TGo4Runnable::PostRun (void* arg)
00078 {
00079 TRACE((12,"TGo4Runnable::PostRun()",__LINE__, __FILE__));
00080
00081 TGo4Log::Debug("Executing Runnable default PostRun Method \n");
00082 return 0;
00083 }