GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ServerTask.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 "TGo4ServerTask.h"
15
16#include "TMutex.h"
17#include "TApplication.h"
18#include "TSystem.h"
19#include "TObjArray.h"
20
21#include "TGo4Log.h"
22#include "TGo4LockGuard.h"
23#include "TGo4Socket.h"
24#include "TGo4BufferQueue.h"
25#include "TGo4Thread.h"
26#include "TGo4ThreadHandler.h"
27#include "TGo4Status.h"
28#include "TGo4CommandInvoker.h"
29#include "TGo4TaskManager.h"
30#include "TGo4TaskHandler.h"
32#include "TGo4Slave.h"
34
35
36const Int_t TGo4ServerTask::fgiOPENWAITCYCLES=100; // wait cycles (100)
37const UInt_t TGo4ServerTask::fguOPENWAITCYCLETIME=100; // time in ms (20)
38const Int_t TGo4ServerTask::fgiCLOSEWAITCYCLES=100; // wait cycles (100)
39const UInt_t TGo4ServerTask::fguCLOSEWAITCYCLETIME=100; // time in ms (20)
40const Int_t TGo4ServerTask::fgiCONNECTWAITCYCLES=20; // wait cycles (20)
41const UInt_t TGo4ServerTask::fguCONNECTWAITCYCLETIME=200; // time in ms (200)
42const UInt_t TGo4ServerTask::fguCONNECTTIMERPERIOD=100; // time in ms (50)
43
44
45const char *TGo4ServerTask::fgcLAUNCHPREFSFILE = "etc/Go4LaunchPrefs.txt";
46
47
49 UInt_t negotiationport,
50 Bool_t blockingmode,
51 Bool_t standalone,
52 Bool_t autostart,
53 Bool_t autocreate,
54 Bool_t ismaster)
55 : TGo4Task(name,blockingmode, autostart,autocreate,ismaster),
56 fxTaskManager(nullptr),fxCurrentTaskHandler(nullptr),
60 fbConnectIsOpen(kFALSE),fbConnectIsDone(kFALSE), fbConnectIsClose(kFALSE),
61 fxConnectorTimer(nullptr)
62{
63 TString nomen("TaskManager of "); nomen += name;
64 fxTaskManager= new TGo4TaskManager(nomen.Data(), this, negotiationport);
65
66 if(negotiationport!=42)
67 {
68 // connector runnable:
69 nomen.Form("ConnectorRunnable of %s", name);
70 TGo4ConnectorRunnable* conny = new TGo4ConnectorRunnable(nomen.Data(),this);
71 nomen.Form("CONNECTOR-%s", name);
72 fxConnectorName=nomen;
73 fxWorkHandler->NewThread(GetConnectorName(), conny);
74 }
75 else {} // do not start connector port in local mode <- nameservice problems without wan!
76
77 TGo4CommandInvoker::Instance(); // make sure a command invoker exists
78 TGo4CommandInvoker::Register("ServerTask", this);
80 fxConnectorTimer->TurnOn();
81 if(standalone)
82 {
83 Launch(); // create threads, start application control timer
84 }
85 else
86 {
87 // subclass must call Launch at end of its ctor
88 }
89}
90
91
99
100Bool_t TGo4ServerTask::RemoveClient(const char *name, Bool_t clientwait, Bool_t isterminating)
101{
102 Bool_t rev=kTRUE;
103 TGo4TaskHandler *taskhandler = nullptr;
104 if(name && strstr(name,"current"))
105 taskhandler=GetCurrentTaskHandler();
106 else
107 taskhandler=GetTaskHandler(name);
108 if(!taskhandler)
109 {
110 // no such taskhandler for name
111 TGo4Log::Debug(" ServerTask -- RemoveClient FAILED, no client %s !!! ",
112 name);
113 rev=kFALSE;
114 }
115 else
116 {
117 TGo4Log::Debug(" ServerTask -- removing client task %s ",name);
118 // first stop all user threads waiting on or writing into the data queues
120 if(clientwait)
121 {
122 // normal mode: handshake with client to be removed
123
124
125 // send quit command to client, client will send dummy objects back
126 // to release waiting sockets
127 // then client will request a disconnect action from the connector runnable
128 if(IsMaster())
129 SubmitEmergencyCommand(kComQuit); // master quits client when removing
130 else
131 SubmitEmergencyData(kComQuit, taskhandler->GetName()); // client data runnable must handle quit request of server!
132 TGo4Log::Debug(" Server Task -- Waiting for client %s disconnection...",taskhandler->GetName());
133 Int_t removeresult=fxTaskManager->WaitForClientRemoved();
134 // disconnection is done by connector
135 // thread using task manager methods
136 switch(removeresult)
137 {
138 case -1:
139 // timeout
140 TGo4Log::Debug(" !!! Server Task -- client remove wait TIMEOUT !!! ");
141 rev=fxTaskManager->DisConnectClient(taskhandler->GetName(),kFALSE); // do not wait for client ok
142 break;
143
144 case -2:
145 // we are terminating the server
146 TGo4Log::Debug(" !!! Server Task -- client remove aborted for TERMINATION MODE !!! ");
147 rev=kFALSE;
148 break;
149
150 default:
151 // all right
152 TGo4Log::Debug(" Server Task -- waited %d cycles until client was removed. ",removeresult);
153 rev=kTRUE;
154 break;
155
156 }
157 } // if(clientwait)
158 else
159 {
160 // no communication with client, just disconnect without waiting
161 TGo4Log::Debug(" !!! Server Task -- removing client %s without waiting... ",
162 taskhandler->GetName());
163 SendStopBuffers(taskhandler->GetName());
164 rev= (fxTaskManager->DisConnectClient(taskhandler->GetName(),kFALSE) == 0); // do not wait
165 }
166 if(!isterminating) StartWorkThreads();
167 }
168 return rev;
169}
170
172{
173 Int_t rev = 0; // return value is number of removed clients
175 TObjArray names;
176 Bool_t reset = kTRUE;
177 while (auto taskhandler = fxTaskManager->NextTaskHandler(reset)) {
178 reset = kFALSE;
179 names.AddLast(new TNamed(taskhandler->GetName(), "title"));
180 }
181 TIter niter(&names);
182 while (auto nomen = niter()) {
183 RemoveClient(nomen->GetName(), !force, kTRUE);
184 rev++;
185 }
186 names.Delete();
187 // end iteration
188 return rev;
189}
190
191
193{
194 Bool_t rev=kTRUE;
196 if (taskhandler) {
197 // we have a current client, remove it
198 TGo4Log::Debug(" Server task -- removing current client %s ", taskhandler->GetName());
199 rev = RemoveClient(taskhandler->GetName());
200 } else {
201 rev = kFALSE;
202 }
203 return rev;
204}
205
206void TGo4ServerTask::SetCurrentTask(const char *name)
207{
208 TGo4TaskHandler *han = nullptr;
209 if (!fxTaskManager) {
210 TGo4Log::Debug(" TGo4ServerTask ''%s'' ERROR- task manager not existing!!! ", GetName());
211 } else {
212 // first stop all user threads waiting on or writing into the data queues
213 if (IsWorkStopped()) {
214 // Working threads have already been stopped
215 // maybe by RemoveClient method.
216 // We do nothing, since the current taskhandler is not
217 // reset yet and any access to current task in the derived
218 // _user_ method would crash the program!
219 } else // if(IsWorkStopped())
220 {
221 // work has not been stopped, we do that
223 } // else if(fbWorkIsStopped)
224 {
225 if (!name) {
226 // zero name given, set pointer to last handler still in list
227 fxCurrentTaskHandler = fxTaskManager->GetLastTaskHandler();
228 } else {
229 // name specified, search for it
230 han = fxTaskManager->GetTaskHandler(name);
231 if (han) {
233 } else {
234 TGo4Log::Debug(" ServerTask: FAILED setting current task to %s-- no such client! ", name);
235 }
236 }
237 }
238
239 // finally, start user threads again
241 }
242}
243
245{
246 return fxTaskManager->GetTaskHandler(name);
247}
248
253
258
263
264void TGo4ServerTask::SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv)
265{
266 fxConnectTransport=trans;
267 fxConnectHost=host;
268 fuConnectPort=port;
269 fbConnectRequest=kTRUE;
270 fbKeepServerSocket=keepserv;
271}
272
278
280{
281 Int_t rev = 0;
285 {
287 // we have a transport instance to disconnect
288 fxDisConnectTransport->Close();
289 // delete fxDisConnectTransport; // new
290 fbConnectIsClose = kTRUE;
291 fbDisConnectRequest = kFALSE; // we served the request, reset it
292 rev += 1;
293 } else {
294 // error, zero pointer given
295 rev += 32;
296 }
297 } else
298 {
299 // no open request, continue
300 rev += 2;
301 }
302
306 {
307 // timer shall open a transport as server
309 {
310
311 if(!fxConnectTransport->IsOpen())
312 {
313 // transport is not open, so do it
314// std::cout << "++++++++Timer will open transport"<< std::endl;
315 fbConnectIsOpen=kTRUE; // tell connector thread that we try to open
317 if(result == 0)
318 {
319 fbConnectIsDone=kTRUE; // tell connector thread we returned from open
320 fbConnectRequest=kFALSE; // we served the request, reset it
321 fbKeepServerSocket=kFALSE; // reset keep server socket flag
322 rev+=4;
323 }
324 else
325 {
326 rev=-4;
327 // open was not finished, we poll once again...
328 }
329 }
330 else
331 {
332 // transport was already open
333// std::cout <<"OOOOOOOOOOOO TimerConnect transport already open!" << std::endl;
334 fbConnectIsOpen=kTRUE;
335 fbConnectIsDone=kTRUE; // tell connector thread we returned from open
336 fbConnectRequest=kFALSE; // we served the request, reset it
337 fbKeepServerSocket=kFALSE; // reset keep server socket flag
338 rev+=8;
339 }
340 }
341 else
342 {
343 rev+=64;
344 // no Transport specified: create raw server for negotiation port
345 //fxConnectTransport=new TGo4Socket("Server",3);
346 }
347 }
348 else
349 {
350 // no open request, continue
351 rev+=16;
352 }
353 return rev;
354}
355
357{
358 Int_t count = 0;
359 while(!fbConnectIsOpen)
360 {
362 {
363 count = -1; // timeout
364 break;
365 }
366 else
367 {
369 ++count;
370 }
371// std::cout << "*****WaitForOpen()"<< std::endl;
372 }
373 fbConnectIsOpen=kFALSE; // reset for next time
374 return count;
375}
376
377
379{
380 Int_t count = 0;
381 while(!fbConnectIsClose)
382 {
384 {
385 count = -1; // timeout
386 break;
387 }
388 else
389 {
391 ++count;
392 }
393 }
394 fbConnectIsClose=kFALSE; // reset for next time
395 return count;
396}
397
399{
400 Int_t count = 0;
401 while(!fbConnectIsDone)
402 {
403 if(IsTerminating())
404 {
405 count = -2; // termination mode
406 break;
407 }
408// timeout would affect the permanent connector port Open, we skip this
409// else if(count>TGo4ServerTask::fgiCONNECTWAITCYCLES)
410// {
411// count = -1; // timeout
412// break;
413// }
414 else
415 {
417 ++count;
418 }
419// std::cout << "*****WaitForConnection()"<< std::endl;
420 }
421 fbConnectIsDone=kFALSE; // reset for next time
422 return count;
423}
424
429
431{
432 TGo4BufferQueue *queue = nullptr;
433 TGo4TaskHandler *currenttask = nullptr;
434 if(!name || strstr(name,"current"))
435 currenttask=GetCurrentTaskHandler(); // find out the current client
436 else
437 currenttask=GetTaskHandler(name); // find out destination client by name
438 if(currenttask)
439 queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetCommandQueue());
440 return queue;
441}
442
444{
445 TGo4BufferQueue *queue = nullptr;
446 TGo4TaskHandler *currenttask = nullptr;
447 if(!name)
448 currenttask=GetCurrentTaskHandler(); // find out the current client
449 else
450 currenttask=GetTaskHandler(name); // find out destination client by name
451 if(currenttask)
452 queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetStatusQueue());
453 return queue;
454}
455
457{
458 TGo4BufferQueue *queue = nullptr;
459 TGo4TaskHandler *currenttask = nullptr;
460 if(!name || strstr(name,"current"))
461 currenttask=GetCurrentTaskHandler(); // find out the current client
462 else
463 currenttask=GetTaskHandler(name); // find out destination client by name
464 if(currenttask)
465 queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetDataQueue());
466 return queue;
467}
468
470{
471 if (IsMaster())
472 return nullptr;
473 TGo4Command *com = nullptr;
474 Bool_t reset = kTRUE;
475 TGo4LockGuard taskmutex(fxTaskManager->GetMutex());
476 while (auto han = fxTaskManager->NextTaskHandler(reset)) {
477 reset = kFALSE;
478 TGo4BufferQueue *comq = dynamic_cast<TGo4BufferQueue *>(han->GetCommandQueue());
479 if (!comq)
480 continue; // NEVER COME HERE!
481 if (!comq->IsEmpty()) { // prevent waiting on queue
482 com = dynamic_cast<TGo4Command *>(comq->WaitObjectFromBuffer());
483 if (com) {
484 com->SetTaskName(han->GetName());
485 com->SetMode(han->GetRole());
486 return com;
487 }
488 }
489 } // while
490 return com;
491}
492
493void TGo4ServerTask::SendStatus(TGo4Status *stat, const char *receiver)
494{
495 if(IsMaster()) return;
496 if(!stat) return;
497 if(receiver) {
498 TGo4Task::SendStatus(stat,receiver);
499 return;
500 }
501 // send status to all
502 TGo4LockGuard taskmutex(fxTaskManager->GetMutex());
503 Bool_t reset = kTRUE;
504 while(auto han = fxTaskManager->NextTaskHandler(reset)) {
505 reset = kFALSE;
506 auto statq = dynamic_cast<TGo4BufferQueue *>(han->GetStatusQueue());
507 if(!statq) continue; //NEVER COME HERE!
508 TGo4Log::Debug(" Task - sending status %s to task %s", stat->ClassName(), han->GetName());
509 statq->AddBufferFromObject(stat);
510 }
511}
512
514{
515 if(IsMaster()) return;
516 TGo4LockGuard statguard(fxStatusMutex); // do not send during buffer update
517 TGo4LockGuard taskmutex(fxTaskManager->GetMutex()); // protect task list
518 Bool_t reset=kTRUE;
519 while(auto han = fxTaskManager->NextTaskHandler(reset)) {
520 reset=kFALSE;
521 TGo4BufferQueue * statq=dynamic_cast<TGo4BufferQueue*> (han->GetStatusQueue());
522 if(!statq) continue; //NEVER COME HERE!
523 TGo4Log::Debug(" Task - sending status buffer to task %s", han->GetName());
524 statq->AddBuffer(fxStatusBuffer,kTRUE);
525 }
526}
527
532
534{
535 Bool_t rev = GetWorkHandler()->Stop( GetConnectorName() ); // unset running flag
536 // now establish a dummy connection to our own server to release the listen socket:
537 const char *host = gSystem->HostName();
538 Int_t negotiationport = fxTaskManager->GetNegotiationPort();
539 TGo4Socket *connector = new TGo4Socket(kTRUE); // raw socket transport
540 connector->Open(host,negotiationport); // open connection to server's connector runnable
541 connector->Send(TGo4TaskHandler::Get_fgcERROR()); // force server to stop
542 connector->Close();
543 delete connector;
544 return rev;
545}
546
547
553
555{
556 TGo4Log::Debug(" ServerTask Quit -- removing all connected clients ");
557 SendStatusMessage(2,kTRUE,"ServerTask %s is shutting down now! All clients are removed...",GetName());
558 auto slave = GetSlave();
559 if(slave) {
560 TGo4Log::Debug(" ServerTask Quit is stopping slave...");
561 slave->Stop(); // to execute analysis postloop if still running
562 }
563 if(!IsMaster()) {
564 fxTaskManager->GetMutex()->UnLock(); // JAM avoid deadlocking of analysis server main thread with connector thread that actually performs the remove
565 }
567 //StopWorkThreads(); // are re-started after last client is removed...
568 WakeCommandQueue(TGo4Task::Get_fgiTERMID()); // will stop local command thread, and remote
569 Terminate(!IsMaster()); // terminate only slave server here!
570// if(!IsMaster())
571// fxTaskManager->GetMutex()->Lock(); // avoid conflicts with lockguard outside
572}
573
574
576{
577 TGo4Log::Debug(" ServerTask Shutdown without disconnect waiting");
578 SendStatusMessage(2,kTRUE,"ServerTask %s is shutting down now! All clients are removed...",GetName());
579 fxTaskManager->GetMutex()->UnLock(); // avoid possible deadlock between main thread and connector thread
580 TGo4Thread::Sleep(10*fguCONNECTTIMERPERIOD); // wait 1 s to broadcast shutdown message before terminating...
582 WakeCommandQueue(TGo4Task::Get_fgiTERMID()); // will stop local command thread, and remote
583
584 RemoveAllClients(true);
585
586 auto slave = GetSlave();
587 if (slave) {
588 TGo4Log::Debug(" ServerTask Shutdown stopping slave...");
589 slave->Stop(); // to execute analysis postloop.
590 // We are within main thread here, i.e. it never stops before termination!
591 slave->SetTask(nullptr, kFALSE); // otherwise owner dtor will delete us...
592 delete slave; // call dtors of analysis framework
593 // SetOwner(0);
594 }
595 fxTaskManager->GetMutex()->Lock();
596 gApplication->Terminate(); // do not wait until appctrl timer terminates us
597}
598
#define TGo4LockGuard
Class containing a pointer queue for TBuffers.
void AddBuffer(TBuffer *buffer, Bool_t clone=kFALSE)
Add buffer pointer to queue.
TObject * WaitObjectFromBuffer()
Wait for buffer object from queue.
static TGo4CommandInvoker * Instance()
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
void SetMode(Go4CommandMode_t m)
Definition TGo4Command.h:83
void SetTaskName(const char *)
Runnable to handle connection request from a new client which connects to a listening Transport chann...
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Definition TGo4Log.cxx:281
Bool_t IsEmpty() const
Definition TGo4Queue.cxx:80
static const UInt_t fguCONNECTWAITCYCLETIME
time for each connect wait cycle
Bool_t fbKeepServerSocket
True if open in server mode shall keep the server socket instance.
Bool_t RemoveCurrentClient()
removes the currently active client from server (disconnect)
static const UInt_t fguCLOSEWAITCYCLETIME
time for each close wait cycle
void SendStatus(TGo4Status *stat, const char *receiver=nullptr) override
Send status object via status channel to the master.
Bool_t ConnectorThreadIsStopped()
Returns the waiting state fbIsWaiting of the Connector Thread;.
TGo4Command * NextCommand() override
Delivers next command.
const char * GetConnectorName() const
TGo4ServerTask(const char *name, UInt_t negotiationport=0, Bool_t blockingmode=kFALSE, Bool_t standalone=kFALSE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE, Bool_t ismaster=kTRUE)
virtual Bool_t StartConnectorThread()
starts the thread that listens to the connector port for a client negotiation request; used after lau...
virtual ~TGo4ServerTask()
TGo4TaskHandler * GetCurrentTaskHandler()
Get task handler of the currently activated client connection.
void SendStatusBuffer() override
Send internal status buffer to the master(s).
static const UInt_t fguCONNECTTIMERPERIOD
period of task connector timer
TGo4BufferQueue * GetStatusQueue(const char *task=nullptr) override
void SetCurrentTask(const char *name)
sets current client task (i.e.
TGo4Socket * GetConnectTransport()
TGo4TaskManager * fxTaskManager
aggregationByValue 1
virtual Int_t TimerConnect()
this method is used by the connectortimer Notify to connect or disconnect a transportchannel (TSocket...
TGo4Socket * fxDisConnectTransport
link to the next TaskHandler transport instance that shall be disconnected by the Application Control...
static const Int_t fgiOPENWAITCYCLES
maximum cycles to wait until transport is open
virtual Int_t RemoveAllClients(Bool_t force=false)
Remove all connected client task from this server.
static const char * Get_fgcLAUNCHPREFSFILE()
UInt_t fuConnectPort
port number for timer connect
static const UInt_t fguOPENWAITCYCLETIME
time for each open wait cycle
TGo4BufferQueue * GetCommandQueue(const char *task=nullptr) override
Bool_t fbConnectIsClose
True if fxConnectTransport has returned from Close(), i.e.
static const char * fgcLAUNCHPREFSFILE
Name of the Preferences file for the client startup.
Bool_t fbConnectIsOpen
True if fxConnectTransport waits in server Open() call.
Bool_t fbDisConnectRequest
True if fxConnectTransport shall be Close() by AppControlTimer.
void Quit() override
Quit method used by quit command; may be overridden in special application.
Bool_t fbConnectRequest
True if fxConnectTransport shall be Open() by AppControlTimer.
TGo4TaskManager * GetTaskManager()
Bool_t fbConnectIsDone
True if fxConnectTransport has returned from Open(), i.e.
const char * GetConnectHost() const
void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE)
static const Int_t fgiCLOSEWAITCYCLES
maximum cycles to wait until transport is closed
TString fxConnectHost
hostname for timer connect
TGo4BufferQueue * GetDataQueue(const char *task=nullptr) override
void Shutdown()
Fast Quit() without waiting for proper disconnection.
TGo4TaskHandler * fxCurrentTaskHandler
1
virtual Bool_t StopConnectorThread()
stops the thread that listens to the connector port for a client negotiation request; used before lau...
TString fxConnectorName
remember name of connector thread
TGo4Socket * fxConnectTransport
link to the next TaskHandler transport instance that shall be connected by the Application Control Ti...
static const Int_t fgiCONNECTWAITCYCLES
maximum cycles to wait until transport is connected
TGo4TaskConnectorTimer * fxConnectorTimer
timer responsible for the connection/disconnection of clients; independent of application control tim...
void SetDisConnect(TGo4Socket *trans)
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
Remove the client task specified by name from this server.
TGo4TaskHandler * GetTaskHandler() override
Get task handler for client specified by name.
virtual Int_t Send(TObject *obj)
virtual Int_t Close(Option_t *opt="")
virtual Int_t Open(const char *host, Int_t port, Bool_t keepservsock=kFALSE)
timer aggregated to the servertask which is responsible to open and handle the negotiation requests o...
This class is responsible for the interconnection of two tasks: provided are three communication chan...
static const char * Get_fgcERROR()
TGo4Queue * GetStatusQueue() const
TGo4Queue * GetDataQueue() const
TGo4Queue * GetCommandQueue() const
Task manager.
virtual Int_t StopWorkThreads()
stop the working threads of the task implementation; this method is used before the current connectio...
Definition TGo4Task.cxx:554
static Int_t Get_fgiTERMID()
Definition TGo4Task.cxx:588
TGo4Task(const char *name, Bool_t blockingmode, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE)
Definition TGo4Task.cxx:39
Bool_t SubmitEmergencyCommand(Go4EmergencyCommand_t val)
send emergency quit command to the current client task
Definition TGo4Task.cxx:433
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
virtual void SendStatus(TGo4Status *stat, const char *receiver=nullptr)
Send status object via status channel to the master.
Definition TGo4Task.cxx:246
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
TBuffer * fxStatusBuffer
Buffer containing the analysis status which is updated by the main thread.
Definition TGo4Task.h:306
Bool_t SubmitEmergencyData(Go4EmergencyCommand_t val, const char *receiver=nullptr)
Send emergency command via data channel.
Definition TGo4Task.cxx:455
TGo4Slave * GetSlave() const
Definition TGo4Task.h:263
Bool_t IsMaster() const
Definition TGo4Task.h:97
virtual Int_t StartWorkThreads()
start the working threads of the task implementation; this method is used after the current connectio...
Definition TGo4Task.cxx:548
TMutex * fxStatusMutex
Mutex protecting status buffer between main and watch thread.
Definition TGo4Task.h:303
Bool_t IsWorkStopped() const
Definition TGo4Task.h:250
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
TGo4Thread * GetThread(const char *name)
Access to Go4Thread by name.
Int_t CancelAll()
Cancel all Threads in the thread list.
Bool_t Start(const char *thname)
Starts work function of the Go4 Thread of name 'name'.
Bool_t Stop(const char *thname)
Stops work function of the Go4 Thread of name 'name'.
TGo4ThreadHandler * fxWorkHandler
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1.
Bool_t IsTerminating() const
returns termination status of Threadmanager
TGo4ThreadHandler * GetWorkHandler() const
Access to ThreadHandler for working threads.
void Launch()
This Method has to be called to create the startup threads and to turn on the application control tim...
go4 thread class
Definition TGo4Thread.h:34
Bool_t IsWaiting() const
true if Threadfunc is suspended to condition wait
Definition TGo4Thread.h:90
static void Sleep(UInt_t millisecs)
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termi...