GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4Runnable.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 "TGo4Runnable.h"
15 
16 #include "TThread.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Thread.h"
20 #include "TGo4ThreadManager.h"
21 #include "TGo4Exception.h"
22 
23 
25  TNamed(right),
26  fxManager(right.fxManager),
27  fxGo4Thread(right.fxGo4Thread)
28 {
29  GO4TRACE((14,"TGo4Runnable::TGo4Runnable() copy constructor",__LINE__, __FILE__));
30 }
31 
33  TNamed(name,"This is a TGo4Runnable")
34 {
35  GO4TRACE((14,"TGo4Runnable::TGo4Runnable(const char *,TGo4ThreadManager *) constructor",__LINE__, __FILE__));
36  fxManager = man;
37 }
38 
40 {
41  GO4TRACE((14,"TGo4Runnable::~TGo4Runnable() destructor",__LINE__, __FILE__));
42 }
43 
45 {
46  GO4TRACE((12,"TGo4Runnable::ThreadCatch()",__LINE__, __FILE__));
47 
48  TGo4Log::Debug("\n %s occured in Runnable``%s''(Thread``%s''PID:%d) \n",
49  ex.What(),GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
50  ex.Handle(); // execute Exception own handler method
51 }
52 
54 {
55  GO4TRACE((12,"TGo4Runnable::UnexpectedCatch()",__LINE__, __FILE__));
56 
57  TGo4Log::Debug("!!!-- Unexpected Exception --!!! occured in Runnable``%s''(Thread``%s''PID:%d) ",
58  GetName(),fxGo4Thread->GetName(),fxGo4Thread->GetPID());
60  TThread::CancelPoint();
61  //gApplication->Terminate(0);
62 }
63 
64 Int_t TGo4Runnable::PreRun (void *arg)
65 {
66  GO4TRACE((12,"TGo4Runnable::PreRun()",__LINE__, __FILE__));
67 
68  TGo4Log::Debug("Executing Runnable default PreRun Method \n");
69  return 0;
70 }
71 
72 Int_t TGo4Runnable::PostRun (void *arg)
73 {
74  GO4TRACE((12,"TGo4Runnable::PostRun()",__LINE__, __FILE__));
75 
76  TGo4Log::Debug("Executing Runnable default PostRun Method \n");
77  return 0;
78 }
virtual void ThreadCatch(TGo4Exception &ex)
TGo4ThreadManager * fxManager
Definition: TGo4Runnable.h:70
TGo4Thread * fxGo4Thread
Definition: TGo4Runnable.h:75
virtual const char * What()
virtual ~TGo4Runnable()
virtual void UnexpectedCatch()
static void Debug(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:281
virtual Int_t PreRun(void *ptr)
virtual Int_t PostRun(void *ptr)
virtual Int_t Handle()
#define GO4TRACE(X)
Definition: TGo4Log.h:25
Int_t GetPID() const
Definition: TGo4Thread.h:72
virtual void Terminate(Bool_t termapp=kTRUE)