GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4RemoveException.cxx
Go to the documentation of this file.
1 // $Id$
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 fuer 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 "TGo4ThreadHandler.h"
21 #include "TGo4Runnable.h"
22 
24 {
25  GO4TRACE((14, "TGo4RemoveException::TGo4RemoveException() copy constructor", __LINE__, __FILE__));
26 }
27 
28 TGo4RemoveException::TGo4RemoveException(TGo4Runnable *runnable, const char *threadname)
29  : TGo4ThreadException(runnable, threadname)
30 {
31  GO4TRACE((14, "TGo4RemoveException::TGo4RemoveException(TGo4Runnable *, const char*) constructor", __LINE__, __FILE__));
32  fxDescription = "!!!-- Go4 Remove Exception --!!!";
33 }
34 
36 {
37  GO4TRACE((14, "TGo4RemoveException::~TGo4RemoveException() destructor", __LINE__, __FILE__));
38 }
39 
41 {
42  GO4TRACE((14, "TGo4RemoveException::operator=", __LINE__, __FILE__));
43  if (&right != this)
44  TGo4ThreadException::operator=(right); // copy base class members
45  return *this;
46 }
47 
49 {
50  GO4TRACE((14, "TGo4RemoveException::Handle()", __LINE__, __FILE__));
51  TString name;
52  if (!GetThreadName()) {
53  // no threadname specified, use name of thread associated with runnable
54  GO4TRACE((13, "TGo4RemoveException::Handle() -- removing thread associated with runnable", __LINE__, __FILE__));
55  name = fxRunnable->GetThread()->GetName();
56  } else {
57  // threadname given, use thread handler to cancel
58  GO4TRACE((13, "TGo4RemoveException::Handle() -- removing thread by specified name", __LINE__, __FILE__));
59  name = GetThreadName();
60  }
61  fxThreadHandler->RemoveThread(name.Data());
62  TThread::CancelPoint();
63  return 0;
64 }
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:44
TGo4ThreadException & operator=(const TGo4ThreadException &right)
TGo4RemoveException()=delete
TGo4Runnable * fxRunnable
TGo4RemoveException & operator=(const TGo4RemoveException &right)
const char * GetThreadName() const
#define GO4TRACE(X)
Definition: TGo4Log.h:25
TGo4ThreadHandler * fxThreadHandler
Bool_t RemoveThread(const char *name)
TString fxDescription
Definition: TGo4Exception.h:38