Dear all, in some recent ROOT version I observed, that some debug output using TThread::Printf(...) in TThread::Fun() is now surrounded by an if (gDebug) { ... } statement. This reminds me of some old question of mine, which I want to repeat now. Our original problem was, that after a TThread::Run() the correspoding thread kept hanging in the first TThread::Printf() call in the function TThread::Fun(). Only when commenting out these Printf() calls we got our programs run - without any further problems with TThread during the last 1 1/2 years. However, we always had to comment out these lines in TThread::Fun(). Consider the following small program: #include "TThread.h" #include <iostream> void* handle(void* ptr) { int nr = (int) ptr; while (1) { TThread::Lock(); std::cerr << "Here I am: " << nr << std::endl; TThread::UnLock(); sleep(1); } } int main() { // gDebug = 1; std::cerr << "Starting Thread 1" << std::endl; TThread *h1 = new TThread("h1", handle, (void*) 1); h1->Run(); std::cerr << "Starting Thread 2" << std::endl; TThread *h2 = new TThread("h2", handle, (void*) 2); h2->Run(); std::cerr << "Starting Thread 3" << std::endl; TThread *h3 = new TThread("h3", handle, (void*) 3); h3->Run(); while(1) {} } In this configuration (with the actual cvs version of ROOT) everything runs fine on all machines (various Linux distributions). But if one enables 'gDebug = 1' the main program reaches the while-loop, but the threads are not running but sticking in the TThread::Fun() function. Since nobody else was complaining about such a behaviour, I assume that the this does not occur for other people. Any clue? Best regards, Volker -- Dr. Volker Hejny Tel: 02461/616853 ** Institut f. Kernphysik Fax: 02461/613930 ** ---------------------------------------------------------------- ** ** --- Forschungszentrum Juelich GmbH, D-52425 Juelich **
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET