17 #include "TIterator.h"
18 #include "TObjArray.h"
22 #include "TGo4LockGuard.h"
28 GO4TRACE((15,
"TGo4ThreadHandler::TGo4ThreadHandler() copy constructor",__LINE__, __FILE__));
37 :TNamed(name,
"This is a TGo4ThreadHandler"),fbIsOperating(kFALSE)
39 GO4TRACE((15,
"TGo4ThreadHandler::TGo4ThreadHandler(const char*, TGo4ThreadManager*) constructor",__LINE__, __FILE__));
50 GO4TRACE((15,
"TGo4ThreadHandler::~TGo4ThreadHandler() destructor",__LINE__, __FILE__));
62 GO4TRACE((14,
"TGo4ThreadHandler::~TGo4ThreadHandler() Removing internal mode thread",__LINE__, __FILE__));
71 GO4TRACE((14,
"TGo4ThreadHandler::~TGo4ThreadHandler() Non internal mode thread",__LINE__, __FILE__));
85 GO4TRACE((14,
"TGo4ThreadHandler::AddThread(TGo4Thread*)",__LINE__, __FILE__));
89 if(
fxArray->FindObject(gthr)==0)
93 GO4TRACE((13,
"TGo4ThreadHandler::AddThread(TGo4Thread*) Adding new go4 thread to array",__LINE__, __FILE__));
100 GO4TRACE((13,
"TGo4ThreadHandler::AddThread(TGo4Thread*) Thread was already in array",__LINE__, __FILE__));
109 GO4TRACE((14,
"TGo4ThreadHandler::RemoveThread(const char*)",__LINE__, __FILE__));
113 TObject* obj=
fxArray->FindObject(name);
118 GO4TRACE((13,
"TGo4ThreadHandler::RemoveThread(const char*) Removing thread from array",__LINE__, __FILE__));
125 GO4TRACE((13,
"TGo4ThreadHandler::RemoveThread(const char*) Deleting internal mode thread",__LINE__, __FILE__));
136 GO4TRACE((13,
"TGo4ThreadHandler::RemoveThread(const char*) Non internal mode thread is not deleted",__LINE__, __FILE__));
142 GO4TRACE((13,
"TGo4ThreadHandler::RemoveThread(const char*) Thread not found in array",__LINE__, __FILE__));
151 GO4TRACE((14,
"TGo4ThreadHandler::NewThread(const char*,TGo4Runnable*)",__LINE__, __FILE__));
156 GO4TRACE((13,
"TGo4ThreadHandler::NewThread(const char*,TGo4Runnable*) No runnable specified error",__LINE__, __FILE__));
162 GO4TRACE((13,
"TGo4ThreadHandler::NewThread(const char*,TGo4Runnable*) Assigning external runnable to new internal thread",__LINE__, __FILE__));
171 GO4TRACE((15,
"TGo4ThreadHandler::CreateAll()",__LINE__, __FILE__));
172 Int_t createdthreads=0;
184 GO4TRACE((13,
"TGo4ThreadHandler::CreateAll() Thread creation success",__LINE__, __FILE__));
189 GO4TRACE((13,
"TGo4ThreadHandler::CreateAll() Thread not created",__LINE__, __FILE__));
196 return createdthreads;
201 GO4TRACE((14,
"TGo4ThreadHandler::Create(const char*)",__LINE__, __FILE__));
207 GO4TRACE((13,
"TGo4ThreadHandler::Create(const char*) Creating new TThread for Go4Thread",__LINE__, __FILE__));
218 GO4TRACE((13,
"TGo4ThreadHandler::Create(const char*) Go4Thread was not found in thread array!",__LINE__, __FILE__));
226 GO4TRACE((15,
"TGo4ThreadHandler::CancelAll()",__LINE__, __FILE__));
227 Int_t cancelledthreads=0;
238 GO4TRACE((13,
"TGo4ThreadHandler::CancelAll() Thread Cancel success",__LINE__, __FILE__));
244 GO4TRACE((13,
"TGo4ThreadHandler::CancelAll() Thread was not canceled",__LINE__, __FILE__));
250 return cancelledthreads;
255 GO4TRACE((14,
"TGo4ThreadHandler::Cancel(const char*)",__LINE__, __FILE__));
261 GO4TRACE((13,
"TGo4ThreadHandler::Cancel(const char*) Canceling TThread",__LINE__, __FILE__));
272 GO4TRACE((13,
"TGo4ThreadHandler::Cancel(const char*) Go4Thread was not found in thread array!",__LINE__, __FILE__));
280 GO4TRACE((15,
"TGo4ThreadHandler::ReCreateAll()",__LINE__, __FILE__));
281 Int_t recreatedthreads=0;
292 GO4TRACE((13,
"TGo4ThreadHandler::ReCreateAll() Thread ReCreate success",__LINE__, __FILE__));
298 GO4TRACE((13,
"TGo4ThreadHandler::ReCreateAll() Thread was not recreated",__LINE__, __FILE__));
304 return recreatedthreads;
309 GO4TRACE((14,
"TGo4ThreadHandler::ReCreate(const char*)",__LINE__, __FILE__));
315 GO4TRACE((13,
"TGo4ThreadHandler::ReCreate(const char*) ReCreating TThread for Go4Thread",__LINE__, __FILE__));
326 GO4TRACE((13,
"TGo4ThreadHandler::ReCreate(const char*) Go4Thread was not found in thread array!",__LINE__, __FILE__));
335 GO4TRACE((15,
"TGo4ThreadHandler::StartAll()",__LINE__, __FILE__));
336 Int_t startedfuncs=0;
351 GO4TRACE((13,
"TGo4ThreadHandler::StartAll() Thread Start success",__LINE__, __FILE__));
358 GO4TRACE((13,
"TGo4ThreadHandler::StartAll() Thread was already running",__LINE__, __FILE__));
369 GO4TRACE((14,
"TGo4ThreadHandler::Start(const char*)",__LINE__, __FILE__));
375 GO4TRACE((13,
"TGo4ThreadHandler::Start(const char*) Starting Thread",__LINE__, __FILE__));
386 GO4TRACE((13,
"TGo4ThreadHandler::Start(const char*) Go4Thread was not found in thread array!",__LINE__, __FILE__));
394 GO4TRACE((15,
"TGo4ThreadHandler::StopAll()",__LINE__, __FILE__));
395 Int_t stoppedfuncs=0;
406 GO4TRACE((13,
"TGo4ThreadHandler::StopAll() Go4Thread Stop success",__LINE__, __FILE__));
413 GO4TRACE((13,
"TGo4ThreadHandler::StopAll() Go4Thread was already stopped",__LINE__, __FILE__));
422 GO4TRACE((14,
"TGo4ThreadHandler::Stop(const char*)",__LINE__, __FILE__));
428 GO4TRACE((13,
"TGo4ThreadHandler::Stop(const char*) Stopping Go4Runnable",__LINE__, __FILE__));
434 GO4TRACE((13,
"TGo4ThreadHandler::Stop(const char*) Go4Thread was not found in thread array!",__LINE__, __FILE__));
442 GO4TRACE((15,
"TGo4ThreadHandler::DumpThreads(Int_t)",__LINE__, __FILE__));
453 GO4TRACE((14,
"TGo4ThreadHandler::DumpThreads(Int_t) mode 0: File output",__LINE__, __FILE__));
454 strcpy(Filename,
"threaddump.txt");
455 fp = fopen(Filename,
"w");
458 GO4TRACE((13,
"TGo4ThreadHandler::DumpThreads(Int_t) fopen failed!!",__LINE__, __FILE__));
459 TGo4Log::Debug(
" ThreadHandler -- Error, Could not open thread dump file!");
465 GO4TRACE((13,
"TGo4ThreadHandler::DumpThreads(Int_t) writing into opened file",__LINE__, __FILE__));
466 fprintf(fp,
"\nTGo4ThreadHandler thread information dump file:\n");
472 fprintf(fp,
"TGo4Thread %d: \tPID:%d \tSelfID: %d",
474 fprintf(fp,
"\t name: %s\n",th->GetName());
479 GO4TRACE((13,
"TGo4ThreadHandler::DumpThreads(Int_t) fclose failed!!",__LINE__, __FILE__));
480 TGo4Log::Debug(
" ThreadHandlerr -- Error, Could not close thread dump file!");
488 GO4TRACE((14,
"TGo4ThreadHandler::DumpThreads(Int_t) mode: default ",__LINE__, __FILE__));
489 TGo4Log::Debug(
" ThreadHandlerr -- Error: DumpThreads mode unknown ");
498 GO4TRACE((12,
"TGo4ThreadHandler::GetThread(const char*)",__LINE__, __FILE__));
509 GO4TRACE((12,
"TGo4ThreadHandler::GetEntries()",__LINE__, __FILE__));
520 GO4TRACE((14,
"TGo4ThreadHandler::AllCreated()",__LINE__, __FILE__));
530 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TThread is _not_ existing",__LINE__, __FILE__));
536 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TThread is existing",__LINE__, __FILE__));
546 GO4TRACE((14,
"TGo4ThreadHandler::AllRunning()",__LINE__, __FILE__));
556 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TGo4Thread is _not_ running",__LINE__, __FILE__));
562 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TGo4Thread is running",__LINE__, __FILE__));
572 GO4TRACE((14,
"TGo4ThreadHandler::AllWaiting()",__LINE__, __FILE__));
582 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TGo4Thread is still running",__LINE__, __FILE__));
589 GO4TRACE((11,
"TGo4ThreadHandler::AllCreated() TGo4Thread is waiting",__LINE__, __FILE__));
TGo4Thread * GetThread(const char *name)
TGo4ThreadManager * fxManager
Bool_t UnBlockApp(Int_t mode=0)
Bool_t ReCreate(const char *thname)
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
Int_t DumpThreads(Int_t mode=0)
Bool_t IsInternal() const
Bool_t Create(const char *thname)
Bool_t Stop(const char *thname)
Bool_t Start(const char *thname)
Bool_t Cancel(const char *thname)
virtual ~TGo4ThreadHandler()
static Int_t GetIgnoreLevel()
Bool_t AddThread(TGo4Thread *gthr)
Bool_t RemoveThread(const char *name)
static void Debug(const char *text,...)