GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4TaskHandlerRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4TaskHandlerRunnable.cxx 2627 2019-10-01 08:02:45Z 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 "TGo4Log.h"
17 #include "TGo4Socket.h"
18 #include "TGo4BufferQueue.h"
19 #include "TGo4TaskHandler.h"
21 
22 #include "TGo4Thread.h"
23 #include "Go4EmergencyCommands.h"
24 
25 TGo4TaskHandlerRunnable::TGo4TaskHandlerRunnable(const char* name, TGo4ThreadManager* man, TGo4TaskHandler* hand, Bool_t receivermode)
26  :TGo4Runnable(name,man), fxTransport(0), fbReceiverMode(0)
27 {
28  fxTaskHandler=hand;
29  fbReceiverMode=receivermode;
30 }
31 
33 {
34 }
35 
37 {
38  return fxTaskHandler;
39 }
40 
41 Bool_t TGo4TaskHandlerRunnable::CheckStopBuffer(TBuffer* buf, Int_t* result)
42 {
43 if(buf==0) return kFALSE;
44 //std::cout <<"CCCCCCCCCC CheckStopBuffer in "<< GetName() << std::endl;
46 if(result) *result=val;
47 if(val<0) return kFALSE; // no valid message in buffer
49 if(comvalue==kComCloseInput)
50  {
51  //std::cout <<"CCCCCCCCCC CheckStopBuffer has close input in "<< GetName() << std::endl;
52  GetThread()->Stop();
53  return kTRUE;
54  }
55 else if (comvalue==kComAbortTask)
56  {
57  //std::cout <<"CCCCCCCCCC CheckStopBuffer has task abort command in "<< GetName() << std::endl;
58  TGo4Log::Debug(" !!!Receiving taskhandler abort buffer in %s !!!", GetName());
60 
61  }
62 else
63  {
64  return kFALSE;
65  }
66 }
67 
69 {
70 Bool_t open=kTRUE;
71 if(fxTransport==0)
72  open=kFALSE;
73 else if(!fxTransport->IsOpen())
74  open=kFALSE;
75 else
76  open=kTRUE;
78  // avoid wild looping in Run() when socket is not open
79 return open;
80 }
Go4EmergencyCommand_t
static UInt_t Get_fguPORTWAITTIME()
Bool_t Stop()
Definition: TGo4Thread.cxx:327
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:45
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:335
TGo4TaskHandler * GetTaskHandler()
static Int_t DecodeValueBuffer(TBuffer *buf)
Bool_t CheckStopBuffer(TBuffer *buf, Int_t *result=0)
Bool_t IsOpen() const
Definition: TGo4Socket.h:36
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274