GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4Task.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
14#include "TGo4Task.h"
15
16#include <stdarg.h>
17
18#include "TFile.h"
19#include "TMutex.h"
20#include "TROOT.h"
21#include "TBufferFile.h"
22
23#include "TGo4Log.h"
24#include "TGo4LockGuard.h"
25#include "TGo4CommandInvoker.h"
26#include "TGo4RemoteCommand.h"
28#include "TGo4ObjectQueue.h"
29#include "TGo4BufferQueue.h"
30#include "TGo4ThreadHandler.h"
31#include "TGo4TaskStatus.h"
32#include "TGo4TaskHandler.h"
34#include "TGo4Master.h"
35#include "TGo4Slave.h"
36
37const Int_t TGo4Task::fgiTERMID=999;
38
39TGo4Task::TGo4Task(const char *name, Bool_t blockingmode,
40 Bool_t autostart,
41 Bool_t autocreate,
42 Bool_t ismaster) :
43 TGo4ThreadManager(name,blockingmode, autostart,autocreate),
44 fbCommandMaster(ismaster), fxMaster(nullptr), fxSlave(nullptr), fxOwner(nullptr),
45 fbWorkIsStopped(kFALSE), fxStopBuffer(nullptr), fxQuitBuffer(nullptr)
46{
47 fxStatusBuffer = new TBufferFile(TBuffer::kWrite);
48 fxStatusMutex = new TMutex(kTRUE);
52
53 TGo4CommandInvoker::Instance(); // make sure we have an invoker instance!
55
56 TGo4CommandInvoker::Register("NoReceiver", this); // for simple command test
57 TGo4CommandInvoker::Register("Task",this); // register as command receiver at the global invoker
58
59
60 // local command queue:
61 fxLocalCommandQueue = new TGo4ObjectQueue("localcommands");
62
63 // local command runnable:
64 TString nomen("LocalCommandRunnable of "); nomen+=name;
65 TGo4LocalCommandRunnable* commander = new TGo4LocalCommandRunnable(nomen.Data(), this);
66
67 fxCommanderName = "COMMANDER-"; fxCommanderName += name;
69}
70
72{
73 if(fxOwner) {
74 fxOwner->SetTask(nullptr, kFALSE); // on termination from threadmanager, we take over responsibility for cleanup
75 delete fxOwner;
76 }
78 delete fxCommandPrototype;
79 delete fxQuitBuffer;
80 delete fxStopBuffer;
81 delete fxStatusBuffer;
82 delete fxStatusMutex;
84}
85
87{
88 if(m) SetMaster(kTRUE);
89 fxMaster=m;
90}
91
93{
94 if(s) SetMaster(kFALSE);
95 fxSlave=s;
96}
97
99{
100 fxOwner=owner;
101 SetMaster(dynamic_cast<TGo4Master *>(owner));
102 SetSlave(dynamic_cast<TGo4Slave *>(owner));
103}
104
106{
107 if(fxSlave) fxSlave->Start();
108}
109
111{
112 if(fxSlave) fxSlave->Stop();
113}
114
116{
117 if(fxSlave) fxSlave->Quit();
118}
119
121{
122 if(fxSlave) fxSlave->KillMain();
123
124}
126{
127 if(fxSlave) fxSlave->RestartMain();
128}
129
130void TGo4Task::Terminate (Bool_t termapp)
131{
132 if(fxSlave)
133 fxSlave->Terminate(termapp);
134 else
136}
137
139{
140 if(fxSlave)
141 fxSlave->TerminateFast();
142 else
144}
145
146void TGo4Task::ExecuteString(const char *command)
147{
148 if(fxSlave)
149 fxSlave->ExecuteString(command);
150 else
151 gROOT->ProcessLineSync(command);
152}
153
155{
156 // keep this method for compatibility reasons, user should not need access to list
157 return fxCommandPrototype;
158}
159
161{
162 if (!IsMaster())
163 return nullptr;
164 TObject *obj = nullptr;
165 TGo4Status *stat = nullptr;
166 TGo4BufferQueue *statqueue = dynamic_cast<TGo4BufferQueue *>(GetStatusQueue());
167 if (statqueue) {
168 // polling mode for timer: we do not go into condition wait!
169 if (!wait && statqueue->IsEmpty())
170 return nullptr;
171 obj = statqueue->WaitObjectFromBuffer();
172 if (obj) {
173 if (obj->InheritsFrom(TGo4Status::Class())) {
174 stat = dynamic_cast<TGo4Status *>(obj);
175 } else {
176 TGo4Log::Debug(" !!! Master Task: NextStatus ERROR, unknown object %s from status queue!!! ",
177 obj->GetName());
178 delete obj;
179 }
180 } else {
181 TGo4Log::Debug(" !!! Master Task NextStatus ERROR -- NULL object from data queue!!! ");
182 }
183 } else {
184 stat = nullptr;
185 }
186 return stat;
187}
188
189TObject *TGo4Task::NextObject(Bool_t wait)
190{
191 if (!IsMaster())
192 return nullptr;
193 TObject *obj = nullptr;
194 TGo4BufferQueue *dataqueue = dynamic_cast<TGo4BufferQueue *>(GetDataQueue());
195 if (dataqueue) {
196 if (!wait && dataqueue->IsEmpty())
197 return nullptr; // polling mode for timer: we do not go into condition wait!
198 obj = dataqueue->WaitObjectFromBuffer(); // wait for buffer and stream object
199
200 } else {
201 obj = nullptr;
202 }
203 return obj;
204}
205
207{
208 fxCommandPrototype->AddCommand(com);
209}
210
212{
213 if(comlist)
214 {
215 *fxCommandPrototype += *comlist;
216 // operator+= of TGo4CommandProtolist puts new commands into old list
217 delete comlist;
218 comlist = nullptr;
219 }
220}
221
222void TGo4Task::SendObject(TObject *obj, const char *receiver)
223{
224 if(IsMaster()) return;
225 if(obj) {
226 // object exists, put it into data queue
227 TGo4BufferQueue * dataq=GetDataQueue(receiver);
228 if(dataq)
229 {
230 // TGo4Log::Debug(" Task - sending object: %s ",obj->GetName());
231 //SendStatusMessage(1, kTRUE,"Task - sending object: %s ",obj->GetName());
232 dataq->AddBufferFromObject(obj);
233 }
234 else
235 {
236 TGo4Log::Debug(" !!! Task - ERROR sending object - no data queue !!! ");
237 }
238 }
239 else
240 {
241 // object not found, send error message through status
242 SendStatusMessage(2, kTRUE, "Task - object not found");
243 }
244}
245
246void TGo4Task::SendStatus(TGo4Status *stat, const char *receiver)
247{
248 if(IsMaster()) return;
249 if(stat) {
250 // object exists, put it into status queue
251 TGo4BufferQueue * statq=GetStatusQueue(receiver);
252 if(statq) {
253 TGo4Log::Debug(" Task - sending status %s ", stat->ClassName());
254 statq->AddBufferFromObject(stat);
255 } else {
256 TGo4Log::Debug(" !!! Task - ERROR sending status: no status queue !!! ");
257 }
258 } else {
259 // TGo4Log::Debug(" !!! Task - ERROR sending status: no such object!!! ");
260 }
261}
262
264{
265 if(IsMaster()) return;
266 TGo4LockGuard statguard(fxStatusMutex); // do not send during buffer update
267 TGo4Log::Debug(" Task - sending status buffer ");
269 if(statq) statq->AddBuffer(fxStatusBuffer,kTRUE);
270}
271
272void TGo4Task::SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
273{
274 if(IsMaster()) return;
275 Int_t lbuflen=256;
276 // put potential printf arguments in text:
277 char txtbuf[256];
278 va_list args;
279 va_start(args, text);
280 vsnprintf(txtbuf, lbuflen, text, args);
281 va_end(args);
282 // figure out here possible destination for message in string:
283 const char *dest;
284 char *curs = txtbuf;
285 TString receiver = txtbuf;
286 Ssiz_t pos = receiver.Index("::",2,0,TString::kExact);
287 if(pos != kNPOS) {
288 // before this we have receiver:
289 receiver.Resize(pos);
290 dest = receiver.Data();
291 curs += ((size_t) pos);
292 curs +=2; // skip separator
293 } else {
294 dest = nullptr;
295 }
296 Bool_t previousmode = TGo4Log::IsOutputEnabled();
297 TGo4Log::OutputEnable(printout); // override the messaging state
298 const char *go4mess = TGo4Log::Message(level, "%s", curs);
299 TGo4Log::OutputEnable(previousmode); // restore old state of messaging
300 if((level > 0) && go4mess) {
301 // do not send debug-level output to gui, and do not send suppressed messages as empty string!
302 auto message = new TGo4Status(go4mess);
303 SendStatus(message, dest);
304 delete message;
305 }
306}
307
309{
310 if(IsMaster()) return;
311 TGo4LockGuard statguard(fxStatusMutex); // do not update during sending
312 TGo4LockGuard main; // protect root streaming
313 TFile *filsav = gFile;
314 gFile = nullptr;
315
316 TGo4TaskStatus *state = fxSlave ? fxSlave->CreateStatus() : CreateStatus();
317
318 fxStatusBuffer->Reset();
319 fxStatusBuffer->InitMap();
320 fxStatusBuffer->WriteObject(state);
321 gFile = filsav;
322 delete state; // avoid memory leak!!
323}
324
326{
327 if(IsMaster()) return nullptr;
329 if(!comq) return nullptr;
330
331 TGo4Command *com = nullptr;
332 if(!comq->IsEmpty() || (fxSlave && !fxSlave->MainIsRunning() ) )
333 {
334 // put new command out of queue
335 // or wait for command if analysis is stopped
336 TObject *obj = comq->WaitObjectFromBuffer();
337 if(obj)
338 {
339 if(obj->InheritsFrom(TGo4Command::Class()))
340 {
341 com = dynamic_cast<TGo4Command *>(obj);
342 com->SetTaskName("current");
344 }
345 else
346 {
347 delete obj;
348 }
349 }
350 else
351 {
352 //TGo4Log::Debug(" !!! Slave ERROR -- NULL object from command queue!!! ");
353 }
354 }
355 else //if(!fxCommandQ->IsEmpty() || !AnalysisIsRunning())
356 {
357 com = nullptr;
358 }
359 return com;
360}
361
363{
364 // this method will be called by the application control timer every timerperiod
365 Int_t rev = -1;
366 if(fbInitDone)
367 // already initialized
368 {
369 rev = 0;
370 }
371 else
372 {
374 {
375 if(fxMaster)
376 {
377 fxCommandPrototype = fxMaster->CreateCommandList(); // use factory method
378 TGo4Log::Debug(" Task -- command list is created from Master factory");
379 }
380 else
381 {
383 TGo4Log::Debug(" Task -- command list is created from Task factory");
384 }
385 }
386 rev = TGo4ThreadManager::Initialization(); // this will launch threads, etc.
387 fxWorkHandler->Start(GetCommanderName()); // for non autostart mode
388 if(fxSlave) fxSlave->Initialization();
389 }// else if(fbInitDone)
390 return rev;
391}
392
394{
395 TGo4TaskHandlerStatus *taskhandlerstatus = nullptr;
397 if(th) taskhandlerstatus = th->CreateStatus();
398 state->SetTaskHandlerStatus(taskhandlerstatus);
400}
401
403{
404 TGo4TaskStatus *stat = new TGo4TaskStatus(GetName());
405 UpdateStatus(stat); // set the internals
406 return stat;
407}
408
409Bool_t TGo4Task::SubmitCommand(const char *name)
410{
411 if(!strcmp(name,"THEMQuit"))
412 {
414 }
415 else if (!strcmp(name,"THEMKill"))
416 {
418 }
419 else if (!strcmp(name,"THEMRestart"))
420 {
422 }
423
424 TGo4Command *com = MakeCommand(name);
425 if (!com) { // only encapsulate commands that are not known here
426 // try simple command with remote command envelope:
427 TGo4LockGuard mainlock;
428 com = new TGo4RemoteCommand(name);
429 }
430 return SubmitCommand(com);
431}
432
434{
436 if(queue)
437 {
438 // we have an active command queue...
439 if(val==kComQuit)
440 {
441 // quit command might be send from thread. use preallocated buffer!
442 queue->AddBuffer(fxQuitBuffer,kTRUE);
443 }
444 else
445 {
446 TBuffer *commandbuffer = TGo4BufferQueue::CreateValueBuffer((UInt_t) val);
447 queue->AddBuffer(commandbuffer); // put command into queue
448 }
449
450 return kTRUE;
451 }
452 return kFALSE;
453}
454
456{
457 TGo4BufferQueue *queue=GetDataQueue(receiver);
458 if(queue)
459 {
460 // we have an active data queue...
461 if(val==kComQuit)
462 {
463 // quit data is send from thread. use preallocated buffer!
464 queue->AddBuffer(fxQuitBuffer,kTRUE);
465 }
466 else
467 {
468 TBuffer *commandbuffer=TGo4BufferQueue::CreateValueBuffer((UInt_t) val);
469 queue->AddBuffer(commandbuffer); // put command into queue
470 }
471 return kTRUE;
472 }
473 return kFALSE;
474}
475
477{
478 if (!com) return kFALSE;
479
480 Bool_t rev=kTRUE;
481 if(com->IsLocal())
483 else {
484 // command for remote client, put into actual client queue
486 if(queue) {
487 // we have an active command queue...
488 TGo4LockGuard mainlock; // protect the streamer!
489 queue->AddBufferFromObject(com); // put command into queue
490 } else
491 rev = kFALSE;
492 delete com; // buffer queue does not adopt com, we delete it
493 }
494 return rev;
495}
496
498{
499 return new TGo4TaskHandlerCommandList("Go4ServerTaskDefaultCommandList");
500}
501
503{
504 TGo4LockGuard mainlock;
505 return fxCommandPrototype->MakeCommand(name);
506}
507
509{
510 if(!com) return kFALSE;
511 com->SetMode(kGo4ComModeAdministrator); // everything is allowed here...
512 fxWorkHandler->Start(GetCommanderName()); // for non autostart mode
514 if(!lqueue) {
515 delete com;
516 return kFALSE;
517 }
518 lqueue->AddObject(com); // object queue adopts command
519 return kTRUE;
520}
521
523{
525 if(th && th->IsAborting()) return;
526
527 // put dummy buffer to command queue. This will wake up the main thread from command wait.
528 TGo4Command *com = new TGo4Command("dummy","this wakes up queue",id);
529 SubmitCommand(com); // wake up main command queue (to taskhandler)
530 com = new TGo4Command("dummy","this wakes up queue",id);
531 SubmitLocalCommand(com); // wake up local command queue
532
533 // note: command is owned by submit command after submit!
534}
535
537{
538 TGo4Log::Debug(" Task ''%s'' Send Status to Command Master ",GetName());
540 if(!queue) return;
541
542 TGo4LockGuard mainguard;
543 // std::cout << "Mainlock acquired by clienttask: GetStatus"<< std::endl;
544 TGo4TaskStatus *state = CreateStatus();
545 queue->AddBufferFromObject(state);
546}
547
549{
550 fbWorkIsStopped = kFALSE;
551 return fxOwner ? fxOwner->StartWorkThreads() : 0;
552}
553
555{
556 fbWorkIsStopped=kTRUE;
557 return fxOwner ? fxOwner->StopWorkThreads() : 0;
558}
559
560void TGo4Task::SendStopBuffers(const char *taskname)
561{
563 if(!th || th->IsAborting()) return;
564
565 if(IsMaster())
566 {
567 TGo4BufferQueue * comq=GetCommandQueue(taskname);
568 if(comq)
569 {
570 comq->AddBuffer(fxStopBuffer,kTRUE);
571 }
572 }
573 else
574 {
575 TGo4BufferQueue * dataq=GetDataQueue(taskname);
576 if(dataq)
577 {
578 dataq->AddBuffer(fxStopBuffer,kTRUE);
579 }
580 TGo4BufferQueue * statq=GetStatusQueue(taskname);
581 if(statq)
582 {
583 statq->AddBuffer(fxStopBuffer,kTRUE);
584 }
585 }//if(IsMaster())
586}
587
589{
590 return fgiTERMID;
591}
592
Go4EmergencyCommand_t
@ kComAbortTask
@ kComRestartMain
@ kComKillMain
@ kComCloseInput
int main(int argc, char **argv)
#define TGo4LockGuard
@ kGo4ComModeController
Definition TGo4Command.h:30
@ kGo4ComModeAdministrator
Definition TGo4Command.h:31
Class containing a pointer queue for TBuffers.
static TBuffer * CreateValueBuffer(UInt_t val)
Create a root buffer that contains a single value val.
void AddBuffer(TBuffer *buffer, Bool_t clone=kFALSE)
Add buffer pointer to queue.
void AddBufferFromObject(TObject *object)
Reconstruct a TObject queue entry from a given TBuffer pointer.
TObject * WaitObjectFromBuffer()
Wait for buffer object from queue.
static TGo4CommandInvoker * Instance()
static void SetCommandList(TGo4CommandProtoList *list)
Application may exchange standard command list by own subclass with specialized commands,...
static void UnRegister(TGo4CommandReceiver *p)
static void Register(const char *name, TGo4CommandReceiver *p)
This is the Go4 Abstract Command Class; part of the Base command pattern.
Definition TGo4Command.h:35
Bool_t IsLocal() const
void SetMode(Go4CommandMode_t m)
Definition TGo4Command.h:83
void SetTaskName(const char *)
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
Display a message.
Definition TGo4Log.cxx:206
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Definition TGo4Log.cxx:281
static void OutputEnable(Bool_t on=kTRUE)
switch output on or off
Definition TGo4Log.cxx:353
static Bool_t IsOutputEnabled()
get current output state
Definition TGo4Log.cxx:358
Master.
Definition TGo4Master.h:27
Class containing a pointer queue for objects.
void AddObject(TObject *object, Bool_t clone=kFALSE)
Add object pointer to queue.
Bool_t IsEmpty() const
Definition TGo4Queue.cxx:80
This command is a container for commands to be send from master to slave via inter-process transport.
Class containing all command prototypes of the TaskHandler system commands (and the basic test comman...
This class is responsible for the interconnection of two tasks: provided are three communication chan...
virtual TGo4TaskHandlerStatus * CreateStatus()
create a status object with information on the current taskhandler state.
Bool_t IsAborting() const
Check whether this instance is currently being aborted.
Task status.
void SetTaskHandlerStatus(TGo4TaskHandlerStatus *thstate)
void SetFlags(Bool_t blocking, Bool_t autocreate, Bool_t autostart, Bool_t terminating, Bool_t initdone)
Int_t Initialization() override
Overrides the ThreadManager Initialization; is used to setup the client connections on demand; checks...
Definition TGo4Task.cxx:362
virtual Int_t StopWorkThreads()
stop the working threads of the task implementation; this method is used before the current connectio...
Definition TGo4Task.cxx:554
TGo4TaskHandlerCommandList * fxCommandPrototype
the command list which holds all command prototypes
Definition TGo4Task.h:315
TBuffer * fxQuitBuffer
this buffer is used for quit command
Definition TGo4Task.h:344
TString fxCommanderName
remember name of localcommand thread
Definition TGo4Task.h:326
static Int_t Get_fgiTERMID()
Definition TGo4Task.cxx:588
virtual TGo4Command * NextCommand()
Delivers next command from command queue.
Definition TGo4Task.cxx:325
TGo4Task(const char *name, Bool_t blockingmode, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE)
Definition TGo4Task.cxx:39
virtual void GetStatus()
Send current status information of the task to the master; may be re-implemented by application subcl...
Definition TGo4Task.cxx:536
Bool_t SubmitEmergencyCommand(Go4EmergencyCommand_t val)
send emergency quit command to the current client task
Definition TGo4Task.cxx:433
void SetMaster(Bool_t on=kTRUE)
Definition TGo4Task.h:298
static const Int_t fgiTERMID
Id number of dummy command that wakes the command queue on termination.
Definition TGo4Task.h:350
TGo4ObjectQueue * GetLocalCommandQueue()
Definition TGo4Task.h:296
void SendStopBuffers(const char *taskname=nullptr)
Send message buffers with stop values into queues and via socket connections.
Definition TGo4Task.cxx:560
void Terminate(Bool_t termapp=kTRUE) override
deletes the Manager instance via Control timer.
Definition TGo4Task.cxx:130
void AddUserCommandList(TGo4CommandProtoList *comlist)
Add a user command list to the existing command list.
Definition TGo4Task.cxx:211
Bool_t SubmitCommand(const char *name)
send command specified by name to the current client task
Definition TGo4Task.cxx:409
void SetOwner(TGo4TaskOwner *owner)
Set owner object and switch automatically in master or slave mode, depending on owner type.
Definition TGo4Task.cxx:98
virtual void SendStatus(TGo4Status *stat, const char *receiver=nullptr)
Send status object via status channel to the master.
Definition TGo4Task.cxx:246
virtual TGo4BufferQueue * GetDataQueue(const char *task=nullptr)
Definition TGo4Task.h:109
TBuffer * fxStopBuffer
this buffer is used for stop message for threads
Definition TGo4Task.h:341
const char * GetCommanderName() const
Definition TGo4Task.h:259
virtual void Stop()
General stop method of client application to be called from remote command; should be re-implemented ...
Definition TGo4Task.cxx:110
virtual TGo4TaskHandlerCommandList * CreateCommandList()
factory method for command list; overridden by implementation
Definition TGo4Task.cxx:497
virtual void SendStatusBuffer()
Send internal status buffer to the master(s).
Definition TGo4Task.cxx:263
virtual void Quit()
Quit the client; method to be called from command object, may be overridden in user implementation.
Definition TGo4Task.cxx:115
TGo4Command * MakeCommand(const char *name)
Method using internal command prototype list to produce a clone of the specified command.
Definition TGo4Task.cxx:502
friend class TGo4TaskOwner
Definition TGo4Task.h:44
void SetSlave(TGo4Slave *s)
Definition TGo4Task.cxx:92
Bool_t SubmitLocalCommand(TGo4Command *com)
Send given command to the current client task.
Definition TGo4Task.cxx:508
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Send message string in a status object to the gui.
Definition TGo4Task.cxx:272
virtual TGo4BufferQueue * GetStatusQueue(const char *task=nullptr)
Definition TGo4Task.h:107
TBuffer * fxStatusBuffer
Buffer containing the analysis status which is updated by the main thread.
Definition TGo4Task.h:306
TBuffer * fxAbortBuffer
this buffer is used for emergency socket aborting
Definition TGo4Task.h:347
TGo4Status * NextStatus(Bool_t wait=kTRUE)
Delivers next status object from status queue.
Definition TGo4Task.cxx:160
virtual void Start()
General start method of client application to be called from remote command; should be re-implemented...
Definition TGo4Task.cxx:105
void AddUserCommand(TGo4Command *com)
Add a user command object to the existing command list.
Definition TGo4Task.cxx:206
virtual void UpdateStatus(TGo4TaskStatus *state)
method needed by method CreateStatus of any status subclasses to set the values of the clienttask spe...
Definition TGo4Task.cxx:393
friend class TGo4LocalCommandRunnable
Definition TGo4Task.h:42
virtual void RestartMain()
Restart the main thread; method to be called from command, should be overridden in user implementatio...
Definition TGo4Task.cxx:125
TGo4TaskOwner * fxOwner
0..1
Definition TGo4Task.h:335
void SendObject(TObject *obj, const char *receiver=nullptr)
Send object via data channel to the master.
Definition TGo4Task.cxx:222
Bool_t SubmitEmergencyData(Go4EmergencyCommand_t val, const char *receiver=nullptr)
Send emergency command via data channel.
Definition TGo4Task.cxx:455
Bool_t fbWorkIsStopped
True if user work threads are stopped for connection change.
Definition TGo4Task.h:338
Bool_t IsMaster() const
Definition TGo4Task.h:97
virtual void ExecuteString(const char *command)
Execute string command.
Definition TGo4Task.cxx:146
Bool_t fbCommandMaster
This flag indicates the main state of the task: either master (sends commands, receives data and stat...
Definition TGo4Task.h:323
TGo4TaskHandlerCommandList * GetPrototype()
get pointer to currently valid command list
Definition TGo4Task.cxx:154
virtual TGo4TaskHandler * GetTaskHandler()
Definition TGo4Task.h:103
void TerminateFast() override
Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly.
Definition TGo4Task.cxx:138
virtual void KillMain()
Kill the main thread; method to be called from command, should be overridden in user implementation.
Definition TGo4Task.cxx:120
void UpdateStatusBuffer()
Create status object and stream it into the status send buffer.
Definition TGo4Task.cxx:308
virtual Int_t StartWorkThreads()
start the working threads of the task implementation; this method is used after the current connectio...
Definition TGo4Task.cxx:548
TGo4Slave * fxSlave
0..1
Definition TGo4Task.h:332
TMutex * fxStatusMutex
Mutex protecting status buffer between main and watch thread.
Definition TGo4Task.h:303
friend class TGo4Slave
Definition TGo4Task.h:43
TGo4Master * fxMaster
0..1
Definition TGo4Task.h:329
TObject * NextObject(Bool_t wait=kTRUE)
Delivers next object from data queue.
Definition TGo4Task.cxx:189
virtual TGo4TaskStatus * CreateStatus()
create a status object with information on the current (slave) task.
Definition TGo4Task.cxx:402
virtual TGo4BufferQueue * GetCommandQueue(const char *task=nullptr)
Definition TGo4Task.h:105
void WakeCommandQueue(Int_t id=0)
Put dummy object into command queue to wake up user threads which might wait for a command.
Definition TGo4Task.cxx:522
virtual ~TGo4Task()
Definition TGo4Task.cxx:71
TGo4ObjectQueue * fxLocalCommandQueue
queue for the server side local commands, submitted by the gui or cli
Definition TGo4Task.h:318
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
Creates new internal Go4 Thread with name and adds it to the List External runnable is passed to spec...
TGo4ThreadHandler * fxWorkHandler
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1.
Bool_t fbAutoStart
If true, workfunctions (runnable Run()) of all go4threads in list shall be started automatically on I...
virtual void TerminateFast()
Alternative termination in case of error.
Bool_t fbTerminating
flag showing termination status
Bool_t fbInitDone
is set kTRUE after first Initialize is done
virtual Int_t Initialization()
TGo4ThreadHandler * GetWorkHandler() const
Access to ThreadHandler for working threads.
Bool_t fbAutoCreate
If true, TThreads of all go4threads in list shall be created automatically on calling Launch().
Bool_t fbAppBlocking
true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall neve...
TGo4ThreadManager(const TGo4ThreadManager &right)
virtual void Terminate(Bool_t termap=kTRUE)
deletes the Manager instance via Control timer.