Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4ThreadManager/TGo4Runnable.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
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          // copy is already source object
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(); // execute Exception own handler method
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    //gApplication->Terminate(0);
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 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:07 2005 for Go4-v2.10-5 by doxygen1.2.15