GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4TaskHandlerRunnable.cxx
Go to the documentation of this file.
1// $Id$
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"
24
26 :TGo4Runnable(name,man), fxTransport(nullptr), fbReceiverMode(0)
27{
28 fxTaskHandler = hand;
29 fbReceiverMode = receivermode;
30}
31
35
40
41Bool_t TGo4TaskHandlerRunnable::CheckStopBuffer(TBuffer *buf, Int_t *result)
42{
43 if (!buf)
44 return kFALSE;
46 if (result)
47 *result = val;
48 if (val < 0)
49 return kFALSE; // no valid message in buffer
51 if (comvalue == kComCloseInput) {
52 GetThread()->Stop();
53 return kTRUE;
54 } else if (comvalue == kComAbortTask) {
55 TGo4Log::Debug(" !!!Receiving taskhandler abort buffer in %s !!!", GetName());
57
58 } else {
59 return kFALSE;
60 }
61}
62
64{
65 Bool_t open = kTRUE;
66 if (!fxTransport)
67 open = kFALSE;
68 else if (!fxTransport->IsOpen())
69 open = kFALSE;
70 else
71 open = kTRUE;
72 if (!open)
74 // avoid wild looping in Run() when socket is not open
75 return open;
76}
Go4EmergencyCommand_t
@ kComAbortTask
@ kComCloseInput
static Int_t DecodeValueBuffer(TBuffer *buf)
Extract value from buffer that was created by CreateValueBuffer method.
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Definition TGo4Log.cxx:281
TGo4Runnable(const TGo4Runnable &right)
TGo4Thread * GetThread() const
Bool_t fbReceiverMode
flag indicating operation mode of runnable, depending on client or server mode of task handler
Bool_t CheckTransportOpen()
Test if socket transport exists and is open.
Bool_t CheckStopBuffer(TBuffer *buf, Int_t *result=nullptr)
Test if buffer contains a message to stop this runnable.
TGo4TaskHandler * fxTaskHandler
link to external task handler (for server mode) 1 1
TGo4Socket * fxTransport
link to external inter-tasl transport channel
This class is responsible for the interconnection of two tasks: provided are three communication chan...
static UInt_t Get_fguPORTWAITTIME()
Go4 thread manager.
Bool_t Stop()
resets running flag for runnable
static void Sleep(UInt_t millisecs)
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termi...