Hi Sergio!
Sergio Luiz Carmelo Barroso - posdoc wrote:
> And the application test05.exe is produced without any errors or warnings.
> The application also runs without errors but the "myThread->Run();"
> apparently is not working, because I do not see the output of the cout
> statements inside the function "doit".
The root Threads will not start before the main root application loop
is running!
Please try to add a TApplication::Run() at the end of
your main program. See modifications in your example:
> --------------------------------------------------------------------------
>
> // test05.cc
> #include "test05.h"
#include "TROOT.h"
#include "TApplication.h"
TROOT threadtest("Test","This is my root");
> int main(int argc, char **argv){
// create application instance:
TApplication theApp("App", 0, 0); // init root application loop
> ThreadPar *myThreadPar = new ThreadPar();
> TThread *myThread = new TThread("MyThread",doit,(void *)
> myThreadPar);
> for (int j=0;j<argc;j++) {
> myThreadPar->count = j;
> myThreadPar->argv = argv[j];
> cout <<"Calling MyThread " << j << '\t' << argv[j] << endl;
> myThread->Run();
> }
theApp.Run(); // this will start the pthreads inside the root threads
> return 0;
> }
Best regards,
Joern
--
/////////////////////////////////////////////////////////////////////
// Dr. J"orn Adamczewski (J.Adamczewski@gsi.de) //
// GO4 project team Tel: +49-6159-71-2554 //
// Datenverarbeitung & ExperimentElektronik FAX: +49-6159-71-2986 //
// Ges. f. SchwerIonenforschung, Planckstr.1, D-64291 Darmstadt //
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET