00001 // $Id: TGo4Runnable.h 1196 2014-04-10 14:06:24Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGo4Runnable_H 00015 #define TGo4Runnable_H 00016 00017 #include "TNamed.h" 00018 00019 #include "TGo4Exception.h" 00020 00021 class TGo4Thread; 00022 class TGo4ThreadManager; 00023 00033 class TGo4Runnable : public TNamed { 00034 friend class TGo4Thread; 00035 00036 public: 00037 TGo4Runnable(const TGo4Runnable &right); 00038 00039 TGo4Runnable (const char* name, TGo4ThreadManager* man); 00040 00041 virtual ~TGo4Runnable(); 00042 00043 void SetThread (TGo4Thread* gthread) { fxGo4Thread=gthread; } 00044 00045 TGo4Thread* GetThread() const { return fxGo4Thread; } 00046 00047 TGo4ThreadManager* GetThreadManager() const { return fxManager; } 00048 00049 protected: 00050 00051 TGo4Runnable(); 00052 00054 virtual Int_t Run (void* ptr) = 0; 00055 00057 virtual Int_t PreRun (void* ptr); 00058 00060 virtual Int_t PostRun (void* ptr); 00061 00063 virtual void ThreadCatch(TGo4Exception& ex); 00064 00066 virtual void UnexpectedCatch (); 00067 00071 TGo4ThreadManager *fxManager; 00072 00076 TGo4Thread *fxGo4Thread; 00077 }; 00078 00079 #endif