GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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),
28{
29 GO4TRACE((14,"TGo4Runnable::TGo4Runnable(const TGo4Runnable &)",__LINE__, __FILE__));
30}
31
33 TNamed(name,"This is a TGo4Runnable")
34{
35 GO4TRACE((14,"TGo4Runnable::TGo4Runnable(const char *,TGo4ThreadManager *)",__LINE__, __FILE__));
36 fxManager = man;
37}
38
40{
41 GO4TRACE((14,"TGo4Runnable::~TGo4Runnable()",__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", ex.What(), GetName(),
49 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());
59 fxManager->Terminate();
60 TThread::CancelPoint();
61 //gApplication->Terminate(0);
62}
63
65{
66 GO4TRACE((12,"TGo4Runnable::PreRun()",__LINE__, __FILE__));
67
68 TGo4Log::Debug("Executing Runnable default PreRun Method \n");
69 return 0;
70}
71
73{
74 GO4TRACE((12,"TGo4Runnable::PostRun()",__LINE__, __FILE__));
75
76 TGo4Log::Debug("Executing Runnable default PostRun Method \n");
77 return 0;
78}
#define GO4TRACE(X)
Definition TGo4Log.h:25
virtual const char * What()
Returns string describing the kind of exception.
virtual Int_t Handle()
This is a default handler function for the respective exception type.
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Definition TGo4Log.cxx:281
TGo4Runnable(const TGo4Runnable &right)
virtual ~TGo4Runnable()
virtual void ThreadCatch(TGo4Exception &ex)
catch for exceptions occurring in workfunc
virtual Int_t PostRun(void *ptr)
Function which is called once after the Run()method on threadstop.
virtual void UnexpectedCatch()
catch for all unexpected exceptions happening in workfunc
TGo4ThreadManager * fxManager
The threadmanager which is responsible for our thread.
TGo4Thread * fxGo4Thread
Backlink to thread which runs this.
virtual Int_t PreRun(void *ptr)
Function which is called once before the Run() method on threadstart.
Go4 thread manager.