GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4RemoveException.cxx
Go to the documentation of this file.
1 // $Id: TGo4RemoveException.cxx 999 2013-07-25 11:58:59Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4RemoveException.h"
15 
16 #include "TThread.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Thread.h"
20 #include "TGo4ThreadManager.h"
21 #include "TGo4ThreadHandler.h"
22 #include "TGo4Runnable.h"
23 
25  :TGo4ThreadException(right)
26 {
27  GO4TRACE((14,"TGo4RemoveException::TGo4RemoveException() copy constructor",__LINE__, __FILE__));
28 }
29 
30 TGo4RemoveException::TGo4RemoveException (TGo4Runnable* runnable, const char* threadname)
31 : TGo4ThreadException(runnable, threadname)
32 {
33  GO4TRACE((14,"TGo4RemoveException::TGo4RemoveException(TGo4Runnable*, const char*) constructor",__LINE__, __FILE__));
34  fxDescription= "!!!-- Go4 Remove Exception --!!!";
35 }
36 
37 
39 {
40  GO4TRACE((14,"TGo4RemoveException::~TGo4RemoveException() destructor",__LINE__, __FILE__));
41 }
42 
43 
45 {
46  GO4TRACE((14,"TGo4RemoveException::operator=",__LINE__, __FILE__));
47  if (&right!=this)
48  {
49  GO4TRACE((13,"TGo4RemoveException::operator= processing copy",__LINE__, __FILE__));
50  TGo4ThreadException::operator=(right); // copy base class members
51  // put additional member copies here...
52  return *this;
53  }
54  else
55  {
56  // copy is already source object
57  GO4TRACE((13,"TGo4RemoveException::operator= source and destination objects are identical",__LINE__, __FILE__));
58  return *this;
59  }
60 }
61 
63 {
64  GO4TRACE((14,"TGo4RemoveException::Handle()",__LINE__, __FILE__));
65  TString name;
66  if(GetThreadName()==0)
67  // no threadname specified, use name of thread associated with runnable
68  {
69  GO4TRACE((13,"TGo4RemoveException::Handle() -- removing thread associated with runnable",__LINE__, __FILE__));
70  name = fxRunnable->GetThread()->GetName();
71  }
72  else
73  // threadname given, use thread handler to cancel
74  {
75  GO4TRACE((13,"TGo4CancelException::Handle() -- removing thread by specified name",__LINE__, __FILE__));
76  name = GetThreadName();
77  }
78  fxThreadHandler->RemoveThread(name.Data());
79  TThread::CancelPoint();
80  return 0;
81 }
TGo4ThreadException & operator=(const TGo4ThreadException &right)
const char * GetThreadName()
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:45
TGo4Runnable * fxRunnable
TGo4RemoveException & operator=(const TGo4RemoveException &right)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
TGo4ThreadHandler * fxThreadHandler
Bool_t RemoveThread(const char *name)
TString fxDescription
Definition: TGo4Exception.h:38