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