GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4RestartException.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 "TGo4RestartException.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  :TGo4ThreadException(right)
25 {
26  GO4TRACE((14,"TGo4RestartException::TGo4RestartException() copy constructor",__LINE__, __FILE__));
27 }
28 
29 TGo4RestartException::TGo4RestartException (TGo4Runnable *runnable, const char *threadname)
30 : TGo4ThreadException(runnable,threadname)
31 {
32  GO4TRACE((14,"TGo4RestartException::TGo4RestartException(TGo4Runnable *, const char*) constructor",__LINE__, __FILE__));
33  fxDescription= "!!!-- Go4 Restart Exception --!!!";
34 }
35 
36 
38 {
39  GO4TRACE((14,"TGo4RestartException::~TGo4RestartException() destructor",__LINE__, __FILE__));
40 }
41 
42 
44 {
45  if (&right != this)
46  TGo4ThreadException::operator=(right); // copy base class members
47  return *this;
48 }
49 
51 {
52  GO4TRACE((14,"TGo4RestartException::Handle()",__LINE__, __FILE__));
53  if(!GetThreadName())
54  // no threadname specified, operate on thread of runnable
55  {
56  GO4TRACE((13,"TGo4RestartException::Handle() -- recreating thread of runnable",__LINE__, __FILE__));
58  }
59  else
60  // threadname given, use thread handler to cancel
61  {
62  GO4TRACE((13,"TGo4RestartException::Handle() -- recreating thread by name",__LINE__, __FILE__));
64  }
65  TThread::CancelPoint(); // if thread restarts itself, this is necessary for proper cancellation:
66  return 0;
67 }
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:44
TGo4ThreadException & operator=(const TGo4ThreadException &right)
TGo4RestartException()=delete
Bool_t ReCreate(const char *thname)
TGo4Runnable * fxRunnable
Bool_t ReCreate()
Definition: TGo4Thread.cxx:215
TGo4RestartException & operator=(const TGo4RestartException &right)
const char * GetThreadName() const
#define GO4TRACE(X)
Definition: TGo4Log.h:25
TGo4ThreadHandler * fxThreadHandler
TString fxDescription
Definition: TGo4Exception.h:38