Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4LocalCommandRunnable.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4LocalCommandRunnable.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TGo4Log.h"
00021 #include "TGo4ServerTask.h"
00022 #include "TGo4Command.h"
00023 #include "TGo4CommandInvoker.h"
00024 #include "TGo4Thread.h"
00025 #include "TGo4ObjectQueue.h"
00026 
00027 TGo4LocalCommandRunnable::TGo4LocalCommandRunnable() :
00028    TGo4Runnable(),
00029    fxLocalTask(0)
00030 {
00031 }
00032 
00033 TGo4LocalCommandRunnable::TGo4LocalCommandRunnable(const char* name, TGo4Task* task) :
00034    TGo4Runnable(name,task),
00035    fxLocalTask(task)
00036 {
00037    TGo4ObjectQueue* fxQueue = 0;
00038    if (fxLocalTask!=0)
00039      fxQueue = fxLocalTask->GetLocalCommandQueue();
00040 }
00041 
00042 TGo4LocalCommandRunnable::~TGo4LocalCommandRunnable()
00043 {
00044 }
00045 
00046 Int_t TGo4LocalCommandRunnable::Run(void* ptr)
00047 {
00048    TGo4ObjectQueue* fxQueue = 0;
00049    if (fxLocalTask!=0)
00050      fxQueue = fxLocalTask->GetLocalCommandQueue();
00051    if(fxQueue!=0) {
00052       TGo4Command* com= dynamic_cast<TGo4Command*> (fxQueue->WaitObject());
00053       if(com!=0) {
00054          if( com->GetCommandID() != TGo4Task::Get_fgiTERMID() ) {
00055             // normal operation if we have not a terminate dummy command
00056             //TGo4LockGuard mainlock; // protect command invocation!
00057             TGo4CommandInvoker::Instance()->Invoke(com); // execute command by invoker
00058           } else {
00059             // terminate dummy command: do not execute, but stop this thread
00060             GetThread()->Stop();
00061           }
00062           delete com;
00063       }
00064    }
00065    return 0;
00066 }
00067 
00068 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:29 2008 for Go4-v3.04-1 by  doxygen 1.4.2