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

/Go4ThreadManager/TGo4RestartException.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 "Go4ThreadManager/TGo4ThreadHandler.h"
00017 #include "Go4ThreadManager/TGo4Runnable.h"
00018 #include "TGo4RestartException.h"
00019 #include "Go4Log/TGo4Log.h"
00020 
00021 TGo4RestartException::TGo4RestartException(const TGo4RestartException &right)
00022   :TGo4ThreadException(right)
00023 {
00024    TRACE((14,"TGo4RestartException::TGo4RestartException() copy constructor",__LINE__, __FILE__));
00025 }
00026 
00027 TGo4RestartException::TGo4RestartException (TGo4Runnable* runnable, const Text_t* threadname)
00028 : TGo4ThreadException(runnable,threadname)
00029 {
00030    TRACE((14,"TGo4RestartException::TGo4RestartException(TGo4Runnable*, const Text_t*) constructor",__LINE__, __FILE__));
00031    fxDescription= "!!!-- Go4 Restart Exception --!!!";
00032 }
00033 
00034 
00035 TGo4RestartException::~TGo4RestartException()
00036 {
00037   TRACE((14,"TGo4RestartException::~TGo4RestartException() destructor",__LINE__, __FILE__));
00038 }
00039 
00040 
00041 TGo4RestartException & TGo4RestartException::operator=(const TGo4RestartException &right)
00042 {
00043    TRACE((14,"TGo4RestartException::operator=",__LINE__, __FILE__));
00044    if (&right!=this)
00045       {
00046          TRACE((13,"TGo4RestartException::operator= processing copy",__LINE__, __FILE__));
00047          TGo4ThreadException::operator=(right); // copy base class members
00048          // put additional member copies here...
00049          return *this;
00050       }
00051    else
00052       {
00053          // copy is already source object
00054          TRACE((13,"TGo4RestartException::operator= source and destination objects are identical",__LINE__, __FILE__));
00055          return *this;
00056       }
00057 }
00058 
00059 Int_t TGo4RestartException::Handle ()
00060 {
00061    TRACE((14,"TGo4RestartException::Handle()",__LINE__, __FILE__));
00062    if(GetThreadName()==0)
00063       // no threadname specified, operate on thread of runnable
00064       {
00065          TRACE((13,"TGo4RestartException::Handle() -- recreating thread of runnable",__LINE__, __FILE__));
00066          fxRunnable->GetThread()->ReCreate();
00067       }
00068    else
00069       // threadname given, use thread handler to cancel
00070       {
00071          TRACE((13,"TGo4RestartException::Handle() -- recreating thread by name",__LINE__, __FILE__));
00072          fxThreadHandler->ReCreate(GetThreadName());
00073       }
00074    TThread::CancelPoint(); // if thread restarts itself, this is necessary for proper cancellation:
00075    return 0;
00076 }
00077 
00078 
00079 
00080 
00081 
00082 //----------------------------END OF GO4 SOURCE FILE ---------------------

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