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