00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #include "TGo4CancelException.h"
00015 
00016 #include "TThread.h"
00017 #include "TGo4Thread.h"
00018 
00019 #include "TGo4Log.h"
00020 #include "TGo4ThreadHandler.h"
00021 #include "TGo4Runnable.h"
00022 
00023 TGo4CancelException::TGo4CancelException(const TGo4CancelException &right)
00024   :TGo4ThreadException(right)
00025 {
00026    TRACE((14,"TGo4CancelException::TGo4CancelException() copy constructor",__LINE__, __FILE__));
00027 }
00028 
00029 TGo4CancelException::TGo4CancelException (TGo4Runnable* runnable, const char* threadname)
00030 : TGo4ThreadException(runnable, threadname)
00031 {
00032    TRACE((14,"TGo4CancelException::TGo4CancelException(TGo4Runnable*, const char*) constructor",__LINE__, __FILE__));
00033    fxDescription= "!!!-- Go4 Cancel Exception --!!!";
00034 }
00035 
00036 
00037 TGo4CancelException::~TGo4CancelException()
00038 {
00039   TRACE((14,"TGo4CancelException::~TGo4CancelException() destructor",__LINE__, __FILE__));
00040 }
00041 
00042 
00043 TGo4CancelException & TGo4CancelException::operator=(const TGo4CancelException &right)
00044 {
00045    TRACE((14,"TGo4CancelException::operator=",__LINE__, __FILE__));
00046    if (&right!=this)
00047       {
00048          TRACE((13,"TGo4CancelException::operator= processing copy",__LINE__, __FILE__));
00049          TGo4ThreadException::operator=(right); 
00050          
00051          return *this;
00052       }
00053    else
00054       {
00055          
00056          TRACE((13,"TGo4CancelException::operator= source and destination objects are identical",__LINE__, __FILE__));
00057          return *this;
00058       }
00059 }
00060 
00061 Int_t TGo4CancelException::Handle()
00062 {
00063    TRACE((14,"TGo4CancelException::Handle()",__LINE__, __FILE__));
00064    if(GetThreadName()==0)
00065       
00066       {
00067          TRACE((13,"TGo4CancelException::Handle() -- canceling thread of runnable",__LINE__, __FILE__));
00068          fxRunnable->GetThread()->Cancel();
00069       }
00070    else
00071       
00072       {
00073          TRACE((13,"TGo4CancelException::Handle() -- canceling thread by name",__LINE__, __FILE__));
00074          fxThreadHandler->Cancel(GetThreadName());
00075       }
00076    TThread::CancelPoint(); 
00077    return 0;
00078 }