GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4CancelException.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 "TGo4CancelException.h"
15
16#include "TThread.h"
17#include "TGo4Thread.h"
18
19#include "TGo4Log.h"
20#include "TGo4ThreadHandler.h"
21#include "TGo4Runnable.h"
22
25{
26 GO4TRACE((14,"TGo4CancelException::TGo4CancelException(const TGo4CancelException &)",__LINE__, __FILE__));
27}
28
29TGo4CancelException::TGo4CancelException (TGo4Runnable *runnable, const char *threadname)
30: TGo4ThreadException(runnable, threadname)
31{
32 GO4TRACE((14,"TGo4CancelException::TGo4CancelException(TGo4Runnable *, const char *)",__LINE__, __FILE__));
33 fxDescription= "!!!-- Go4 Cancel Exception --!!!";
34}
35
36
38{
39 GO4TRACE((14,"TGo4CancelException::~TGo4CancelException()",__LINE__, __FILE__));
40}
41
42
44{
45 GO4TRACE((14, "TGo4CancelException::operator=", __LINE__, __FILE__));
46 if (&right != this)
47 TGo4ThreadException::operator=(right); // copy base class members
48 return *this;
49}
50
52{
53 GO4TRACE((14,"TGo4CancelException::Handle()",__LINE__, __FILE__));
54 if (!GetThreadName()) {
55 // no threadname specified, operate on thread of runnable
56 GO4TRACE((13, "TGo4CancelException::Handle() -- canceling thread of runnable", __LINE__, __FILE__));
57 fxRunnable->GetThread()->Cancel();
58 } else {
59 // threadname given, use thread handler to cancel
60 GO4TRACE((13, "TGo4CancelException::Handle() -- canceling thread by name", __LINE__, __FILE__));
62 }
63 TThread::CancelPoint(); // if thread cancels itself, this is necessary for proper cancellation:
64 return 0;
65}
#define GO4TRACE(X)
Definition TGo4Log.h:25
TGo4CancelException & operator=(const TGo4CancelException &right)
TGo4CancelException()=delete
Int_t Handle() override
This is a default handler function for the respective exception type.
TString fxDescription
Base class for all go4 runnables.
TGo4ThreadException()=delete
TGo4Runnable * fxRunnable
Link to the runnable connected with the thread (exception throwing runnable might simply pass its 'th...
const char * GetThreadName() const
TGo4ThreadException & operator=(const TGo4ThreadException &right)
TGo4ThreadHandler * fxThreadHandler
Link to threadhandler associated with the runnable.