GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4LocalCommandRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4LocalCommandRunnable.cxx 1037 2013-11-06 13:39:24Z linev $
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 für 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 
15 
16 #include "TGo4Log.h"
17 #include "TGo4ServerTask.h"
18 #include "TGo4Command.h"
19 #include "TGo4CommandInvoker.h"
20 #include "TGo4Thread.h"
21 #include "TGo4ObjectQueue.h"
22 
24  TGo4Runnable(),
25  fxLocalTask(0)
26 {
27 }
28 
30  TGo4Runnable(name,task),
31  fxLocalTask(task)
32 {
33 }
34 
36 {
37 }
38 
40 {
42 
43  if(fxQueue!=0) {
44  TGo4Command* com = dynamic_cast<TGo4Command*> (fxQueue->WaitObject());
45  if(com!=0) {
46  if( com->GetCommandID() != TGo4Task::Get_fgiTERMID() ) {
47  // normal operation if we have not a terminate dummy command
48  //TGo4LockGuard mainlock; // protect command invocation!
49  TGo4CommandInvoker::Instance()->Invoke(com); // execute command by invoker
50  } else {
51  // terminate dummy command: do not execute, but stop this thread
52  GetThread()->Stop();
53  }
54  delete com;
55  }
56  }
57  return 0;
58 }
Int_t GetCommandID() const
Definition: TGo4Command.cxx:63
Bool_t Stop()
Definition: TGo4Thread.cxx:328
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:45
TGo4ObjectQueue * GetLocalCommandQueue()
Definition: TGo4Task.h:289
static TGo4CommandInvoker * Instance()
TObject * WaitObject()
virtual void Invoke(TGo4Command *com)
virtual Int_t Run(void *ptr)
static Int_t Get_fgiTERMID()
Definition: TGo4Task.cxx:635