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