33 GO4TRACE((14,
"TGo4TestRunnable::TGo4Runnable()", __LINE__, __FILE__));
38 GO4TRACE((14,
"TGo4TestRunnable::TGo4TestRunnable(const TGo4TestRunnable &)", __LINE__, __FILE__));
44 GO4TRACE((14,
"TGo4TestRunnable::TGo4TestRunnable(const char *,TGo4ThreadManager *, Int_t)", __LINE__, __FILE__));
49 GO4TRACE((14,
"TGo4TestRunnable::~TGo4TestRunnable()",__LINE__, __FILE__));
54 GO4TRACE((12,
"TGo4TestRunnable::Run()",__LINE__, __FILE__));
58 static Int_t loops = 0;
70 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 0",__LINE__, __FILE__));
78 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 1",__LINE__, __FILE__));
85 han->
Cancel(
"First Thread");
86 han->
Cancel(
"Second Thread");
87 han->
Cancel(
"Third Thread");
88 han->
Cancel(
"Fourth Thread");
90 TGo4Log::Debug(
"\t ''%s'' re-starting all other Threads", GetName());
91 han->
Create(
"First Thread");
92 han->
Create(
"Second Thread");
93 han->
Create(
"Third Thread");
94 han->
Create(
"Fourth Thread");
99 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 2",__LINE__, __FILE__));
100 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
103 TGo4Log::Debug(
"\t ''%s'' stopping all other Workfunctions:", GetName());
105 han->
Stop(
"First Thread");
106 han->
Stop(
"Second Thread");
107 han->
Stop(
"Third Thread");
108 han->
Stop(
"Fourth Thread");
110 TGo4Log::Debug(
"\t ''%s'' re-starting all other Workfunctions:", GetName());
111 han->
Start(
"First Thread");
112 han->
Start(
"Second Thread");
113 han->
Start(
"Third Thread");
114 han->
Start(
"Fourth Thread");
120 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 3",__LINE__, __FILE__));
121 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
132 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 4",__LINE__, __FILE__));
133 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
139 fxHisto =
new TH1D(GetName(),
"histogram",2048,0,100);
147 x=gRandom->Gaus(50,7);
151 if(strstr(GetName(),
"Maker1"))
163 TThread::CancelPoint();
167 TThread::CancelPoint();
168 if(strstr(GetName(),
"Maker1"))
199 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 5",__LINE__, __FILE__));
200 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
208 TString rname = TString::Format(
"NewHistogramMaker1:%d",loops++);
216 go4thr=
new TGo4Thread(
"First Thread",th1run,kFALSE);
244 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 6",__LINE__, __FILE__));
245 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
270 GO4TRACE((11,
"TGo4TestRunnable::Run() mode 7",__LINE__, __FILE__));
271 TGo4Log::Debug(
" ControlRunnable ''%s'' running, testcase %d -- ",
276 fxHisto =
new TH1D(GetName(),
"histogram",2048,0,100);
284 x=gRandom->Gaus(50,7);
293 TGo4Log::Debug(
"\t ''%s'' histogram %d filled, waiting", GetName(),loops);
295 TGo4Log::Debug(
"\t ''%s'' deleting histogram %d", GetName(),loops++);
302 GO4TRACE((11,
"TGo4TestRunnable::Run() mode default",__LINE__, __FILE__));
303 TGo4Log::Debug(
" TestRunnable ''%s'' mode %d -- unspecified Workfunc action! ", GetName(),
fiMode);
314 GO4TRACE((12,
"TGo4TestRunnable::ThreadCatch()",__LINE__, __FILE__));
328 GO4TRACE((12,
"TGo4TestRunnable::UnexpectedCatch()",__LINE__, __FILE__));
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
TGo4Runnable(const TGo4Runnable &right)
virtual void ThreadCatch(TGo4Exception &ex)
catch for exceptions occurring in workfunc
virtual void UnexpectedCatch()
catch for all unexpected exceptions happening in workfunc
TGo4ThreadManager * fxManager
The threadmanager which is responsible for our thread.
TGo4Thread * fxGo4Thread
Backlink to thread which runs this.
Exception which terminates the threadmanager and the application.
void UnexpectedCatch() override
catch for all unexpected exceptions happening in workfunc
void ThreadCatch(TGo4Exception &ex) override
catch for exceptions occurring in workfunc
Int_t Run(void *ptr) override
The working function which runs in the thread.
virtual ~TGo4TestRunnable()
Int_t fiMode
mode number which can be used to create runnables with different actions in Workfunc; useful for test...
Example of a user subclass of the threadmanager.
Bool_t Start(const char *thname)
Starts work function of the Go4 Thread of name 'name'.
Bool_t Create(const char *thname)
Launch the ROOT Thread specified by the Go4 Thread of name 'name'.
Bool_t Stop(const char *thname)
Stops work function of the Go4 Thread of name 'name'.
Bool_t Cancel(const char *thname)
Cancels the ROOT Thread specified by the Go4 Thread of name 'name'.
Bool_t Cancel()
Cancels TThread.