Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4TaskHandler/TGo4LocalCommandRunnable.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 <iostream.h>
00019 
00020 #include "Go4Log/TGo4Log.h"
00021 #include "TGo4ServerTask.h"
00022 #include "Go4CommandsBase/TGo4CommandInvoker.h"
00023 #include "Go4CommandsBase/TGo4Command.h"
00024 #include "Go4Queue/TGo4ObjectQueue.h"
00025 #include "TGo4Task.h"
00026 
00027 TGo4LocalCommandRunnable::TGo4LocalCommandRunnable(const char* name, TGo4Task* task)
00028    :TGo4Runnable(name,task), fxLocalTask(task), fxQueue(0)
00029 {
00030    if(task) fxQueue=task->GetLocalCommandQueue();
00031 }
00032 
00033 
00034 TGo4LocalCommandRunnable::~TGo4LocalCommandRunnable()
00035 {
00036 
00037 }
00038 
00039 
00040 Int_t TGo4LocalCommandRunnable::Run(void* ptr)
00041 {
00042    fxQueue=fxLocalTask->GetLocalCommandQueue();
00043    if(fxQueue)
00044       {
00045          TGo4Command* com= dynamic_cast<TGo4Command*> (fxQueue->WaitObject());
00046          if(com)
00047             {
00048             if( com->GetCommandID() != TGo4Task::fgiTERMID )
00049                {
00050                    // normal operation if we have not a terminate dummy command
00051                      //TGo4LockGuard mainlock; // protect command invocation!
00052                      TGo4CommandInvoker::Instance()->Invoke(com); // execute command by invoker
00053                      
00054                }
00055             else
00056                {
00057                   // terminate dummy command: do not execute, but stop this thread
00058                   GetThread()->Stop();
00059                }
00060             delete com;
00061             }
00062          }
00063    return 0;
00064 }
00065 
00066 
00067 
00068 
00069 
00070 
00071 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:06 2005 for Go4-v2.10-5 by doxygen1.2.15