00001 // $Id: TGo4Runnable.h 478 2009-10-29 12:26:09Z 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 00034 class TGo4Runnable : public TNamed { 00035 friend class TGo4Thread; 00036 00037 public: 00038 TGo4Runnable(const TGo4Runnable &right); 00039 00040 TGo4Runnable (const char* name, TGo4ThreadManager* man); 00041 00042 virtual ~TGo4Runnable(); 00043 00044 void SetThread (TGo4Thread* gthread) { fxGo4Thread=gthread; } 00045 00046 TGo4Thread* GetThread() const { return fxGo4Thread; } 00047 00048 TGo4ThreadManager* GetThreadManager() const { return fxManager; } 00049 00050 protected: 00051 00052 TGo4Runnable(); 00053 00055 virtual Int_t Run (void* ptr) = 0; 00056 00058 virtual Int_t PreRun (void* ptr); 00059 00061 virtual Int_t PostRun (void* ptr); 00062 00064 virtual void ThreadCatch(TGo4Exception& ex); 00065 00067 virtual void UnexpectedCatch (); 00068 00072 TGo4ThreadManager *fxManager; 00073 00077 TGo4Thread *fxGo4Thread; 00078 }; 00079 00080 #endif