GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Runnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4Runnable.cxx 2627 2019-10-01 08:02:45Z 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 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 "TGo4Runnable.h"
15 
16 #include "TThread.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Thread.h"
20 #include "TGo4ThreadManager.h"
21 
23  TNamed(),
24  fxManager(0),
25  fxGo4Thread(0)
26 {
27 }
28 
30  TNamed(right),
31  fxManager(right.fxManager),
32  fxGo4Thread(right.fxGo4Thread)
33 {
34  GO4TRACE((14,"TGo4Runnable::TGo4Runnable() copy constructor",__LINE__, __FILE__));
35 }
36 
38  TNamed(name,"This is a TGo4Runnable"), fxGo4Thread(0)
39 {
40  GO4TRACE((14,"TGo4Runnable::TGo4Runnable(const char*,TGo4ThreadManager*) constructor",__LINE__, __FILE__));
41  fxManager=man;
42 }
43 
45 {
46  GO4TRACE((14,"TGo4Runnable::~TGo4Runnable() destructor",__LINE__, __FILE__));
47 }
48 
50 {
51  GO4TRACE((12,"TGo4Runnable::ThreadCatch()",__LINE__, __FILE__));
52 
53  TGo4Log::Debug("\n %s occured in Runnable``%s''(Thread``%s''PID:%d) \n",
54  ex.What(),GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
55  ex.Handle(); // execute Exception own handler method
56 }
57 
59 {
60  GO4TRACE((12,"TGo4Runnable::UnexpectedCatch()",__LINE__, __FILE__));
61 
62  TGo4Log::Debug("!!!-- Unexpected Exception --!!! occured in Runnable``%s''(Thread``%s''PID:%d) ",
63  GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
65  TThread::CancelPoint();
66  //gApplication->Terminate(0);
67 }
68 
69 Int_t TGo4Runnable::PreRun (void* arg)
70 {
71  GO4TRACE((12,"TGo4Runnable::PreRun()",__LINE__, __FILE__));
72 
73  TGo4Log::Debug("Executing Runnable default PreRun Method \n");
74  return 0;
75 }
76 
77 Int_t TGo4Runnable::PostRun (void* arg)
78 {
79  GO4TRACE((12,"TGo4Runnable::PostRun()",__LINE__, __FILE__));
80 
81  TGo4Log::Debug("Executing Runnable default PostRun Method \n");
82  return 0;
83 }
virtual void ThreadCatch(TGo4Exception &ex)
TGo4ThreadManager * fxManager
Definition: TGo4Runnable.h:71
TGo4Thread * fxGo4Thread
Definition: TGo4Runnable.h:76
virtual const char * What()
virtual ~TGo4Runnable()
virtual void UnexpectedCatch()
virtual Int_t PreRun(void *ptr)
virtual Int_t PostRun(void *ptr)
virtual Int_t Handle()
#define GO4TRACE(X)
Definition: TGo4Log.h:26
Int_t GetPID() const
Definition: TGo4Thread.h:70
virtual void Terminate(Bool_t termapp=kTRUE)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:284