GSI Object Oriented Online Offline (Go4) GO4-6.4.0
|
Go4 Task. More...
#include <TGo4Task.h>
Public Member Functions | |
TGo4Task (const char *name, Bool_t blockingmode, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE) | |
virtual | ~TGo4Task () |
void | AddUserCommand (TGo4Command *com) |
Add a user command object to the existing command list. | |
void | AddUserCommandList (TGo4CommandProtoList *comlist) |
Add a user command list to the existing command list. | |
virtual TGo4TaskStatus * | CreateStatus () |
create a status object with information on the current (slave) task. | |
virtual void | ExecuteString (const char *command) |
Execute string command. | |
TBuffer * | GetAbortBuffer () |
Use preallocated abort buffer to stop remote socket wait from taskhandler itself. | |
const char * | GetCommanderName () const |
virtual TGo4BufferQueue * | GetCommandQueue (const char *task=nullptr) |
virtual TGo4BufferQueue * | GetDataQueue (const char *task=nullptr) |
TGo4Master * | GetMaster () const |
TGo4Slave * | GetSlave () const |
virtual void | GetStatus () |
Send current status information of the task to the master; may be re-implemented by application subclass of TGo4Task. | |
TMutex * | GetStatusBufferMutex () |
Access to the mutex of status buffer. | |
virtual TGo4BufferQueue * | GetStatusQueue (const char *task=nullptr) |
virtual TGo4TaskHandler * | GetTaskHandler () |
Int_t | Initialization () override |
Overrides the ThreadManager Initialization; is used to setup the client connections on demand; checks for fbConnectRequest flag. | |
Bool_t | IsMaster () const |
Bool_t | IsWorkStopped () const |
virtual void | KillMain () |
Kill the main thread; method to be called from command, should be overridden in user implementation. | |
TGo4Command * | MakeCommand (const char *name) |
Method using internal command prototype list to produce a clone of the specified command. | |
virtual TGo4Command * | NextCommand () |
Delivers next command from command queue. | |
TObject * | NextObject (Bool_t wait=kTRUE) |
Delivers next object from data queue. | |
TGo4Status * | NextStatus (Bool_t wait=kTRUE) |
Delivers next status object from status queue. | |
virtual void | Quit () |
Quit the client; method to be called from command object, may be overridden in user implementation. | |
virtual void | RestartMain () |
Restart the main thread; method to be called from command, should be overridden in user implementation. | |
void | SendObject (TObject *obj, const char *receiver=nullptr) |
Send object via data channel to the master. | |
virtual void | SendStatus (TGo4Status *stat, const char *receiver=nullptr) |
Send status object via status channel to the master. | |
virtual void | SendStatusBuffer () |
Send internal status buffer to the master(s). | |
void | SendStatusMessage (Int_t level, Bool_t printout, const char *text,...) |
Send message string in a status object to the gui. | |
void | SendStopBuffers (const char *taskname=nullptr) |
Send message buffers with stop values into queues and via socket connections. | |
void | SetOwner (TGo4TaskOwner *owner) |
Set owner object and switch automatically in master or slave mode, depending on owner type. | |
virtual void | Start () |
General start method of client application to be called from remote command; should be re-implemented by application. | |
virtual Int_t | StartWorkThreads () |
start the working threads of the task implementation; this method is used after the current connection has changed, to continue reading/writing the queues. | |
virtual void | Stop () |
General stop method of client application to be called from remote command; should be re-implemented by application. | |
virtual Int_t | StopWorkThreads () |
stop the working threads of the task implementation; this method is used before the current connection is changed to prevent reading/writing and waiting for the wrong queues. | |
Bool_t | SubmitCommand (const char *name) |
send command specified by name to the current client task | |
Bool_t | SubmitCommand (TGo4Command *com) |
send given command to the current client task. | |
Bool_t | SubmitEmergencyCommand (Go4EmergencyCommand_t val) |
send emergency quit command to the current client task | |
Bool_t | SubmitEmergencyData (Go4EmergencyCommand_t val, const char *receiver=nullptr) |
Send emergency command via data channel. | |
Bool_t | SubmitLocalCommand (TGo4Command *com) |
Send given command to the current client task. | |
void | Terminate (Bool_t termapp=kTRUE) override |
deletes the Manager instance via Control timer. | |
void | TerminateFast () override |
Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly. | |
void | UpdateStatusBuffer () |
Create status object and stream it into the status send buffer. | |
void | WakeCommandQueue (Int_t id=0) |
Put dummy object into command queue to wake up user threads which might wait for a command. | |
![]() | |
TGo4ThreadManager (const char *name, Bool_t blockingmode=kTRUE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE) | |
Normal constructor. | |
TGo4ThreadManager (const TGo4ThreadManager &right) | |
virtual | ~TGo4ThreadManager () |
Bool_t | BlockApp () |
Blocks gSystem by means of the blocking timer. | |
TGo4ThreadHandler * | GetWorkHandler () const |
Access to ThreadHandler for working threads. | |
Bool_t | IsAppBlocking () const |
Returns true if threadmanager works in root system blocking mode. | |
Bool_t | IsBeingQuit () const |
Returns true if threadmanager works in root system blocking mode. | |
Bool_t | IsInitDone () const |
Bool_t | IsTerminateApp () const |
Bool_t | IsTerminating () const |
returns termination status of Threadmanager | |
void | Launch () |
This Method has to be called to create the startup threads and to turn on the application control timer. | |
void | SetBeingQuit (Bool_t on) |
void | SetTimer (TGo4AppControlTimer *ctrltimer) |
user can exchange the standard control timer by an own derived one by this method | |
Bool_t | UnBlockApp (Int_t mode=0) |
Wakes up the control timer waiting for his condition; parameter mode specifies whether timer will block again at next turn (mode = 0), timer will block when all threads are up (mode = 1), or timer will not block again unless the next Block call, i.e. | |
![]() | |
TGo4CommandReceiver () | |
virtual | ~TGo4CommandReceiver () |
Static Public Member Functions | |
static Int_t | Get_fgiTERMID () |
Protected Member Functions | |
virtual TGo4TaskHandlerCommandList * | CreateCommandList () |
factory method for command list; overridden by implementation | |
TGo4ObjectQueue * | GetLocalCommandQueue () |
TGo4TaskHandlerCommandList * | GetPrototype () |
get pointer to currently valid command list | |
void | SetMaster (Bool_t on=kTRUE) |
void | SetWorkIsStopped (Bool_t on) |
virtual void | UpdateStatus (TGo4TaskStatus *state) |
method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object. | |
Protected Attributes | |
TBuffer * | fxStatusBuffer {nullptr} |
Buffer containing the analysis status which is updated by the main thread. | |
TMutex * | fxStatusMutex {nullptr} |
Mutex protecting status buffer between main and watch thread. | |
![]() | |
Bool_t | fbAppBlocking {kFALSE} |
true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall never be blocked (necessary for gui) | |
Bool_t | fbAutoCreate {kFALSE} |
If true, TThreads of all go4threads in list shall be created automatically on calling Launch(). | |
Bool_t | fbAutoStart {kFALSE} |
If true, workfunctions (runnable Run()) of all go4threads in list shall be started automatically on Initialization. | |
Int_t | fbBeingQuit {0} |
Bool_t | fbInitDone {kFALSE} |
is set kTRUE after first Initialize is done | |
Bool_t | fbTerminateApplication {kFALSE} |
If true, terminate complete application. | |
Bool_t | fbTerminating {kFALSE} |
flag showing termination status | |
TGo4AppControlTimer * | fxBlocker {nullptr} |
Composition of Application control timer. | |
TGo4ThreadHandler * | fxWorkHandler {nullptr} |
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1. | |
Private Member Functions | |
void | SetMaster (TGo4Master *m) |
void | SetSlave (TGo4Slave *s) |
Private Attributes | |
Bool_t | fbCommandMaster {kFALSE} |
This flag indicates the main state of the task: either master (sends commands, receives data and status), or slave (receives commands and may send date and status) | |
Bool_t | fbWorkIsStopped {kFALSE} |
True if user work threads are stopped for connection change. | |
TBuffer * | fxAbortBuffer {nullptr} |
this buffer is used for emergency socket aborting | |
TString | fxCommanderName |
remember name of localcommand thread | |
TGo4TaskHandlerCommandList * | fxCommandPrototype {nullptr} |
the command list which holds all command prototypes | |
TGo4ObjectQueue * | fxLocalCommandQueue {nullptr} |
queue for the server side local commands, submitted by the gui or cli | |
TGo4Master * | fxMaster {nullptr} |
0..1 | |
TGo4TaskOwner * | fxOwner {nullptr} |
0..1 | |
TBuffer * | fxQuitBuffer {nullptr} |
this buffer is used for quit command | |
TGo4Slave * | fxSlave {nullptr} |
0..1 | |
TBuffer * | fxStopBuffer {nullptr} |
this buffer is used for stop message for threads | |
Static Private Attributes | |
static const Int_t | fgiTERMID =999 |
Id number of dummy command that wakes the command queue on termination. | |
Friends | |
class | TGo4LocalCommandRunnable |
class | TGo4Slave |
class | TGo4TaskOwner |
Additional Inherited Members | |
![]() | |
enum | { fguTEXTLENGTH = 256 } |
Default textlength for char arrays. More... | |
![]() | |
static const Long_t | fglTIMERPERIOD = 200 |
Period in ms for the application control timer. | |
Go4 Task.
Definition at line 39 of file TGo4Task.h.
TGo4Task::TGo4Task | ( | const char * | name, |
Bool_t | blockingmode, | ||
Bool_t | autostart = kFALSE, | ||
Bool_t | autocreate = kTRUE, | ||
Bool_t | ismaster = kFALSE ) |
Definition at line 39 of file TGo4Task.cxx.
References TGo4ThreadManager::TGo4ThreadManager(), CreateCommandList(), TGo4BufferQueue::CreateValueBuffer(), fbCommandMaster, fbWorkIsStopped, fxAbortBuffer, fxCommanderName, fxLocalCommandQueue, fxMaster, fxOwner, fxQuitBuffer, fxSlave, fxStatusBuffer, fxStatusMutex, fxStopBuffer, GetCommanderName(), TGo4ThreadManager::GetWorkHandler(), TGo4CommandInvoker::Instance(), kComAbortTask, kComCloseInput, kComQuit, TGo4ThreadHandler::NewThread(), TGo4CommandInvoker::Register(), TGo4CommandInvoker::SetCommandList(), and TGo4LocalCommandRunnable.
Referenced by TGo4ClientTask::TGo4ClientTask(), and TGo4ServerTask::TGo4ServerTask().
|
virtual |
Definition at line 71 of file TGo4Task.cxx.
References fxCommandPrototype, fxLocalCommandQueue, fxOwner, fxQuitBuffer, fxStatusBuffer, fxStatusMutex, fxStopBuffer, and TGo4CommandInvoker::UnRegister().
void TGo4Task::AddUserCommand | ( | TGo4Command * | com | ) |
Add a user command object to the existing command list.
This can be done on the fly. Command receiver name of user command must match "Analysis", "AnalysisClient", or the name of the user analysis to be executed on the remote side.
Definition at line 206 of file TGo4Task.cxx.
References fxCommandPrototype.
void TGo4Task::AddUserCommandList | ( | TGo4CommandProtoList * | comlist | ) |
Add a user command list to the existing command list.
This can be done on the fly. Commands of the user list are added to the existing command list.
Definition at line 211 of file TGo4Task.cxx.
References fxCommandPrototype.
|
protectedvirtual |
factory method for command list; overridden by implementation
Reimplemented in TGo4ExampleServer.
Definition at line 497 of file TGo4Task.cxx.
Referenced by TGo4Task(), and Initialization().
|
virtual |
create a status object with information on the current (slave) task.
this object may be sent to the master or may be used to restore current status by memento mechanism
Reimplemented in TGo4ClientTask, and TGo4ExampleClient.
Definition at line 402 of file TGo4Task.cxx.
References UpdateStatus().
Referenced by GetStatus(), and UpdateStatusBuffer().
|
virtual |
Execute string command.
Uses gInterpreter by default. May be overridden to evaluate go4 command strings in subclass.
Definition at line 146 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4ComExecLine::ExeCom().
|
static |
Definition at line 588 of file TGo4Task.cxx.
References fgiTERMID.
Referenced by TGo4ClientTask::DisconnectServer(), TGo4ServerTask::Quit(), TGo4AnalysisMainRunnable::Run(), TGo4LocalCommandRunnable::Run(), and TGo4ServerTask::Shutdown().
|
inline |
Use preallocated abort buffer to stop remote socket wait from taskhandler itself.
Definition at line 276 of file TGo4Task.h.
References fxAbortBuffer.
|
inline |
Definition at line 259 of file TGo4Task.h.
References fxCommanderName.
Referenced by TGo4Task(), Initialization(), and SubmitLocalCommand().
|
inlinevirtual |
Reimplemented in TGo4ClientTask, and TGo4ServerTask.
Definition at line 105 of file TGo4Task.h.
Referenced by NextCommand(), TGo4AnalysisProxy::ReceiveStatus(), SendStopBuffers(), SubmitCommand(), and SubmitEmergencyCommand().
|
inlinevirtual |
Reimplemented in TGo4ClientTask, and TGo4ServerTask.
Definition at line 109 of file TGo4Task.h.
Referenced by NextObject(), SendObject(), SendStopBuffers(), and SubmitEmergencyData().
|
inlineprotected |
Definition at line 296 of file TGo4Task.h.
References fxLocalCommandQueue.
Referenced by SubmitLocalCommand().
|
inline |
Definition at line 261 of file TGo4Task.h.
References fxMaster.
Referenced by TGo4TaskHandlerAbortException::Handle().
|
protected |
get pointer to currently valid command list
Definition at line 154 of file TGo4Task.cxx.
References fxCommandPrototype.
|
inline |
Definition at line 263 of file TGo4Task.h.
References fxSlave, and TGo4Slave.
Referenced by TGo4TaskHandlerAbortException::Handle(), TGo4ServerTask::Quit(), and TGo4ServerTask::Shutdown().
|
virtual |
Send current status information of the task to the master; may be re-implemented by application subclass of TGo4Task.
Definition at line 536 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBufferFromObject(), CreateStatus(), TGo4Log::Debug(), GetStatusQueue(), and TGo4LockGuard.
|
inline |
Access to the mutex of status buffer.
To be locked outside any command, otherwise deadlocking possible
Definition at line 158 of file TGo4Task.h.
References fxStatusMutex.
|
inlinevirtual |
Reimplemented in TGo4ClientTask, and TGo4ServerTask.
Definition at line 107 of file TGo4Task.h.
Referenced by GetStatus(), NextStatus(), SendStatus(), SendStatusBuffer(), and SendStopBuffers().
|
inlinevirtual |
Reimplemented in TGo4ClientTask, and TGo4ServerTask.
Definition at line 103 of file TGo4Task.h.
Referenced by SendStopBuffers(), UpdateStatus(), and WakeCommandQueue().
|
overridevirtual |
Overrides the ThreadManager Initialization; is used to setup the client connections on demand; checks for fbConnectRequest flag.
Reimplemented from TGo4ThreadManager.
Definition at line 362 of file TGo4Task.cxx.
References CreateCommandList(), TGo4Log::Debug(), TGo4ThreadManager::fbInitDone, fxCommandPrototype, fxMaster, fxSlave, TGo4ThreadManager::fxWorkHandler, GetCommanderName(), and TGo4ThreadManager::Initialization().
Referenced by TGo4ClientTask::Initialization().
|
inline |
Definition at line 97 of file TGo4Task.h.
References fbCommandMaster.
Referenced by TGo4ClientTask::TGo4ClientTask(), TGo4ClientTask::ConnectServer(), TGo4ClientTask::DisconnectServer(), TGo4ServerTask::NextCommand(), NextCommand(), NextObject(), NextStatus(), TGo4ClientTask::Quit(), TGo4ServerTask::Quit(), TGo4ServerTask::RemoveClient(), SendObject(), TGo4ServerTask::SendStatus(), SendStatus(), TGo4ServerTask::SendStatusBuffer(), SendStatusBuffer(), SendStatusMessage(), SendStopBuffers(), and UpdateStatusBuffer().
|
inline |
Definition at line 250 of file TGo4Task.h.
References fbWorkIsStopped.
Referenced by TGo4ServerTask::SetCurrentTask().
|
virtual |
Kill the main thread; method to be called from command, should be overridden in user implementation.
Definition at line 120 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4CommandRunnable::Run().
TGo4Command * TGo4Task::MakeCommand | ( | const char * | name | ) |
Method using internal command prototype list to produce a clone of the specified command.
Definition at line 502 of file TGo4Task.cxx.
References fxCommandPrototype, and TGo4LockGuard.
Referenced by SubmitCommand().
|
virtual |
Delivers next command from command queue.
Reimplemented in TGo4ServerTask.
Definition at line 325 of file TGo4Task.cxx.
References fxSlave, GetCommandQueue(), TGo4Queue::IsEmpty(), IsMaster(), kGo4ComModeController, TGo4Command::SetMode(), TGo4Command::SetTaskName(), and TGo4BufferQueue::WaitObjectFromBuffer().
Referenced by TGo4Slave::NextCommand(), and TGo4MainRunnable::Run().
TObject * TGo4Task::NextObject | ( | Bool_t | wait = kTRUE | ) |
Delivers next object from data queue.
Encapsulates the queue wait and the object streaming. Streamer is decoupled from queue wait and sets global lockguard. If wait=kFALSE, queue will be polled once instead of condition wait.
Definition at line 189 of file TGo4Task.cxx.
References GetDataQueue(), TGo4Queue::IsEmpty(), IsMaster(), and TGo4BufferQueue::WaitObjectFromBuffer().
Referenced by TGo4DisplayDrawerTimer::Notify().
TGo4Status * TGo4Task::NextStatus | ( | Bool_t | wait = kTRUE | ) |
Delivers next status object from status queue.
Encapsulates the queue wait and the object streaming. Streamer is decoupled from queue wait and sets global lockguard. If wait=kFALSE, queue will be polled once instead of condition wait.
Definition at line 160 of file TGo4Task.cxx.
References TGo4Log::Debug(), GetStatusQueue(), TGo4Queue::IsEmpty(), IsMaster(), and TGo4BufferQueue::WaitObjectFromBuffer().
Referenced by TGo4DisplayLoggerTimer::Notify().
|
virtual |
Quit the client; method to be called from command object, may be overridden in user implementation.
Reimplemented in TGo4ClientTask, and TGo4ServerTask.
Definition at line 115 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4ComQuit::ExeCom(), and TGo4ClientTask::Quit().
|
virtual |
Restart the main thread; method to be called from command, should be overridden in user implementation.
Definition at line 125 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4CommandRunnable::Run().
void TGo4Task::SendObject | ( | TObject * | obj, |
const char * | receiver = nullptr ) |
Send object via data channel to the master.
Master name may be specified, if more than one master is connected. By default, object is send to current active task
Definition at line 222 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBufferFromObject(), TGo4Log::Debug(), GetDataQueue(), IsMaster(), and SendStatusMessage().
Referenced by TGo4Slave::SendObject().
|
virtual |
Send status object via status channel to the master.
Master name may be specified, if more than one master is connected. By default, object is send to all connected tasks
Reimplemented in TGo4ServerTask.
Definition at line 246 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBufferFromObject(), TGo4Log::Debug(), GetStatusQueue(), and IsMaster().
Referenced by TGo4ServerTask::SendStatus(), TGo4Slave::SendStatus(), and SendStatusMessage().
|
virtual |
Send internal status buffer to the master(s).
Reimplemented in TGo4ServerTask.
Definition at line 263 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBuffer(), TGo4Log::Debug(), fxStatusBuffer, fxStatusMutex, GetStatusQueue(), IsMaster(), and TGo4LockGuard.
Referenced by TGo4WatchRunnable::Run(), and TGo4Slave::SendStatusBuffer().
void TGo4Task::SendStatusMessage | ( | Int_t | level, |
Bool_t | printout, | ||
const char * | text, | ||
... ) |
Send message string in a status object to the gui.
Will be displayed in status window. Level indicates info, warning or error. Message text may begin with name of receiver for message, followed by "::". If no receiver is defined, all connected masters will receive message (default).
Definition at line 272 of file TGo4Task.cxx.
References IsMaster(), TGo4Log::IsOutputEnabled(), TGo4Log::Message(), TGo4Log::OutputEnable(), and SendStatus().
Referenced by TGo4ClientTask::ConnectServer(), TGo4ComExecLine::ExeCom(), TGo4ComStart::ExeCom(), TGo4ComStop::ExeCom(), TGo4ClientTask::Quit(), TGo4ServerTask::Quit(), TGo4TaskHandlerCommand::RefuseCom(), TGo4WatchRunnable::Run(), SendObject(), TGo4Slave::SendStatusMessage(), and TGo4ServerTask::Shutdown().
void TGo4Task::SendStopBuffers | ( | const char * | taskname = nullptr | ) |
Send message buffers with stop values into queues and via socket connections.
Used in disconnect procedure to put taskhandler threads into suspend mode, i.e. wake them from socket receive or queue wait. For multiple client connection, taskname defines which client to stop.
Definition at line 560 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBuffer(), fxStopBuffer, GetCommandQueue(), GetDataQueue(), GetStatusQueue(), GetTaskHandler(), TGo4TaskHandler::IsAborting(), and IsMaster().
Referenced by TGo4ClientTask::DisconnectServer(), and TGo4ServerTask::RemoveClient().
|
inlineprotected |
Definition at line 298 of file TGo4Task.h.
References fbCommandMaster.
Referenced by TGo4ExampleClient::TGo4ExampleClient(), SetMaster(), SetOwner(), and SetSlave().
|
private |
Definition at line 86 of file TGo4Task.cxx.
References fxMaster, and SetMaster().
void TGo4Task::SetOwner | ( | TGo4TaskOwner * | owner | ) |
Set owner object and switch automatically in master or slave mode, depending on owner type.
Definition at line 98 of file TGo4Task.cxx.
References fxOwner, SetMaster(), SetSlave(), TGo4Slave, and TGo4TaskOwner.
|
private |
Definition at line 92 of file TGo4Task.cxx.
References fxSlave, SetMaster(), and TGo4Slave.
Referenced by SetOwner().
|
inlineprotected |
Definition at line 300 of file TGo4Task.h.
References fbWorkIsStopped.
|
virtual |
General start method of client application to be called from remote command; should be re-implemented by application.
Reimplemented in TGo4ExampleClient.
Definition at line 105 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4ComStart::ExeCom().
|
virtual |
start the working threads of the task implementation; this method is used after the current connection has changed, to continue reading/writing the queues.
To be overridden by the derived task.
Reimplemented in TGo4ExampleServer.
Definition at line 548 of file TGo4Task.cxx.
References fbWorkIsStopped, and fxOwner.
Referenced by TGo4ClientTask::DisconnectServer(), TGo4ServerTask::RemoveClient(), TGo4ServerTask::SetCurrentTask(), and TGo4ExampleServer::StartWorkThreads().
|
virtual |
General stop method of client application to be called from remote command; should be re-implemented by application.
Reimplemented in TGo4ExampleClient.
Definition at line 110 of file TGo4Task.cxx.
References fxSlave.
Referenced by TGo4ComStop::ExeCom().
|
virtual |
stop the working threads of the task implementation; this method is used before the current connection is changed to prevent reading/writing and waiting for the wrong queues.
To be overridden by the derived task.
Reimplemented in TGo4ExampleServer.
Definition at line 554 of file TGo4Task.cxx.
References fbWorkIsStopped, and fxOwner.
Referenced by TGo4ClientTask::DisconnectServer(), TGo4ServerTask::RemoveClient(), TGo4ServerTask::SetCurrentTask(), TGo4ServerTask::Shutdown(), and TGo4ExampleServer::StopWorkThreads().
Bool_t TGo4Task::SubmitCommand | ( | const char * | name | ) |
send command specified by name to the current client task
Definition at line 409 of file TGo4Task.cxx.
References kComKillMain, kComQuit, kComRestartMain, MakeCommand(), SubmitCommand(), SubmitEmergencyCommand(), and TGo4LockGuard.
Referenced by TGo4TaskHandlerAbortException::Handle(), TGo4Master::SubmitCommand(), TGo4Master::SubmitCommand(), SubmitCommand(), and WakeCommandQueue().
Bool_t TGo4Task::SubmitCommand | ( | TGo4Command * | com | ) |
send given command to the current client task.
Command object is deleted after this call internally!
Definition at line 476 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBufferFromObject(), GetCommandQueue(), TGo4Command::IsLocal(), SubmitLocalCommand(), and TGo4LockGuard.
Bool_t TGo4Task::SubmitEmergencyCommand | ( | Go4EmergencyCommand_t | val | ) |
send emergency quit command to the current client task
Definition at line 433 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBuffer(), TGo4BufferQueue::CreateValueBuffer(), fxQuitBuffer, GetCommandQueue(), and kComQuit.
Referenced by TGo4ServerTask::RemoveClient(), SubmitCommand(), and TGo4Master::SubmitEmergencyCommand().
Bool_t TGo4Task::SubmitEmergencyData | ( | Go4EmergencyCommand_t | val, |
const char * | receiver = nullptr ) |
Send emergency command via data channel.
For analysis server shutdown, to inform clients about disconnect
Definition at line 455 of file TGo4Task.cxx.
References TGo4BufferQueue::AddBuffer(), TGo4BufferQueue::CreateValueBuffer(), fxQuitBuffer, GetDataQueue(), and kComQuit.
Referenced by TGo4ServerTask::RemoveClient().
Bool_t TGo4Task::SubmitLocalCommand | ( | TGo4Command * | com | ) |
Send given command to the current client task.
Command object is deleted after this call internally!
Definition at line 508 of file TGo4Task.cxx.
References TGo4ObjectQueue::AddObject(), TGo4ThreadManager::fxWorkHandler, GetCommanderName(), GetLocalCommandQueue(), kGo4ComModeAdministrator, and TGo4Command::SetMode().
Referenced by TGo4CommandRunnable::Run(), TGo4DataRunnable::Run(), SubmitCommand(), TGo4AnalysisClient::SubmitShutdown(), and WakeCommandQueue().
|
overridevirtual |
deletes the Manager instance via Control timer.
termap | if true, also terminates the root Application |
Reimplemented from TGo4ThreadManager.
Definition at line 130 of file TGo4Task.cxx.
References fxSlave, and TGo4ThreadManager::Terminate().
Referenced by TGo4Master::DisconnectSlave(), TGo4ClientTask::Initialization(), TGo4ClientTask::Quit(), and TGo4ServerTask::Quit().
|
overridevirtual |
Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly.
Reimplemented from TGo4ThreadManager.
Definition at line 138 of file TGo4Task.cxx.
References fxSlave, and TGo4ThreadManager::TerminateFast().
Referenced by TGo4TaskHandlerAbortException::Handle().
|
protectedvirtual |
method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object.
Reimplemented in TGo4ClientTask, and TGo4ExampleClient.
Definition at line 393 of file TGo4Task.cxx.
References TGo4TaskHandler::CreateStatus(), TGo4ThreadManager::fbAppBlocking, TGo4ThreadManager::fbAutoCreate, TGo4ThreadManager::fbAutoStart, TGo4ThreadManager::fbInitDone, TGo4ThreadManager::fbTerminating, GetTaskHandler(), TGo4TaskStatus::SetFlags(), and TGo4TaskStatus::SetTaskHandlerStatus().
Referenced by CreateStatus(), TGo4ClientTask::UpdateStatus(), and TGo4Slave::UpdateStatus().
void TGo4Task::UpdateStatusBuffer | ( | ) |
Create status object and stream it into the status send buffer.
To be executed from the main thread; buffer will be send by status thread.
Definition at line 308 of file TGo4Task.cxx.
References CreateStatus(), fxSlave, fxStatusBuffer, fxStatusMutex, IsMaster(), main(), and TGo4LockGuard.
Referenced by TGo4WatchRunnable::Run(), and TGo4Slave::UpdateStatusBuffer().
void TGo4Task::WakeCommandQueue | ( | Int_t | id = 0 | ) |
Put dummy object into command queue to wake up user threads which might wait for a command.
To be used in quit and restart methods. Id can set in such way that application can check the command id for special action, e.g. stop thread in case of termination.
Definition at line 522 of file TGo4Task.cxx.
References GetTaskHandler(), TGo4TaskHandler::IsAborting(), SubmitCommand(), and SubmitLocalCommand().
Referenced by TGo4ClientTask::DisconnectServer(), TGo4AnalysisClient::KillMain(), TGo4ServerTask::Quit(), TGo4AnalysisClient::RestartMain(), and TGo4ServerTask::Shutdown().
|
friend |
Definition at line 42 of file TGo4Task.h.
References TGo4LocalCommandRunnable.
Referenced by TGo4Task(), and TGo4LocalCommandRunnable.
|
friend |
Definition at line 43 of file TGo4Task.h.
References TGo4Slave.
Referenced by GetSlave(), SetOwner(), SetSlave(), and TGo4Slave.
|
friend |
Definition at line 44 of file TGo4Task.h.
References TGo4TaskOwner.
Referenced by SetOwner(), and TGo4TaskOwner.
|
private |
This flag indicates the main state of the task: either master (sends commands, receives data and status), or slave (receives commands and may send date and status)
Definition at line 323 of file TGo4Task.h.
Referenced by TGo4Task(), IsMaster(), and SetMaster().
|
private |
True if user work threads are stopped for connection change.
Definition at line 338 of file TGo4Task.h.
Referenced by TGo4Task(), IsWorkStopped(), SetWorkIsStopped(), StartWorkThreads(), and StopWorkThreads().
|
staticprivate |
Id number of dummy command that wakes the command queue on termination.
Definition at line 350 of file TGo4Task.h.
Referenced by Get_fgiTERMID().
|
private |
this buffer is used for emergency socket aborting
Definition at line 347 of file TGo4Task.h.
Referenced by TGo4Task(), and GetAbortBuffer().
|
private |
remember name of localcommand thread
Definition at line 326 of file TGo4Task.h.
Referenced by TGo4Task(), and GetCommanderName().
|
private |
the command list which holds all command prototypes
Definition at line 315 of file TGo4Task.h.
Referenced by ~TGo4Task(), AddUserCommand(), AddUserCommandList(), GetPrototype(), Initialization(), and MakeCommand().
|
private |
queue for the server side local commands, submitted by the gui or cli
Definition at line 318 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), and GetLocalCommandQueue().
|
private |
0..1
Definition at line 329 of file TGo4Task.h.
Referenced by TGo4Task(), GetMaster(), Initialization(), and SetMaster().
|
private |
0..1
Definition at line 335 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), SetOwner(), StartWorkThreads(), and StopWorkThreads().
|
private |
this buffer is used for quit command
Definition at line 344 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), SubmitEmergencyCommand(), and SubmitEmergencyData().
|
private |
0..1
Definition at line 332 of file TGo4Task.h.
Referenced by TGo4Task(), ExecuteString(), GetSlave(), Initialization(), KillMain(), NextCommand(), Quit(), RestartMain(), SetSlave(), Start(), Stop(), Terminate(), TerminateFast(), and UpdateStatusBuffer().
|
protected |
Buffer containing the analysis status which is updated by the main thread.
Definition at line 306 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), TGo4ServerTask::SendStatusBuffer(), SendStatusBuffer(), and UpdateStatusBuffer().
|
protected |
Mutex protecting status buffer between main and watch thread.
Definition at line 303 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), GetStatusBufferMutex(), TGo4ServerTask::SendStatusBuffer(), SendStatusBuffer(), and UpdateStatusBuffer().
|
private |
this buffer is used for stop message for threads
Definition at line 341 of file TGo4Task.h.
Referenced by TGo4Task(), ~TGo4Task(), and SendStopBuffers().