]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: use of BasicsGenericDestructor
authorprascle <prascle>
Mon, 3 Oct 2005 09:49:35 +0000 (09:49 +0000)
committerprascle <prascle>
Mon, 3 Oct 2005 09:49:35 +0000 (09:49 +0000)
src/SALOMELocalTrace/FileTraceCollector.cxx
src/SALOMELocalTrace/LocalTraceBufferPool.cxx
src/SALOMETraceCollector/SALOMETraceCollector.cxx

index e5e51cd2be51d9c11ee95dfb7303c285f655c9ef..6015c5070d54652fef9c6652d36ebfbfa04ed675 100644 (file)
@@ -130,8 +130,8 @@ void* FileTraceCollector::run(void *bid)
 
       while ((!_threadToClose) || myTraceBuffer->toCollect() )
        {
-         //if (_threadToClose)
-         //  cerr << "FileTraceCollector _threadToClose" << endl << flush;
+         if (_threadToClose)
+           cerr << "FileTraceCollector _threadToClose" << endl << flush;
 
          int fullBuf = myTraceBuffer->retrieve(myTrace);
          if (myTrace.traceType == ABORT_MESS)
@@ -167,11 +167,12 @@ void* FileTraceCollector::run(void *bid)
 #endif
            }
        }
-      //cerr <<"traceFile.close();" << endl << flush;
+      cerr <<"traceFile.close();" << endl << flush;
       traceFile.close();
+      cerr <<"traceFile.close()_end;" << endl << flush;
+      pthread_exit(NULL);
     }
-  pthread_exit(NULL);
-  return NULL;
+  //return NULL;
 }
 
 // ============================================================================
@@ -186,7 +187,7 @@ FileTraceCollector:: ~FileTraceCollector()
   ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
   if (_singleton)
     {
-      //cerr << "FileTraceCollector:: ~FileTraceCollector()" << endl << flush;
+      cerr << "FileTraceCollector:: ~FileTraceCollector()" << endl << flush;
       LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
       _threadToClose = 1;
       myTraceBuffer->insert(NORMAL_MESS,"end of trace\n"); // to wake up thread
@@ -194,7 +195,7 @@ FileTraceCollector:: ~FileTraceCollector()
        {
          int ret = pthread_join(*_threadId, NULL);
          if (ret) cerr << "error close FileTraceCollector : "<< ret << endl;
-         //else cerr << "FileTraceCollector destruction OK" << endl;
+         else cerr << "FileTraceCollector destruction OK" << endl;
          _threadId = 0;
          _threadToClose = 0;
        }
index 94fed5fd3edaafda8de5f61103d9b00777a2e8e2..bdc98695dfb520979c85be35f61d7c7434ebdf74 100644 (file)
@@ -84,8 +84,8 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance()
        {                                      // the lock after the first test
          _singleton = new LocalTraceBufferPool(); 
 
-         DESTRUCTOR_OF<LocalTraceBufferPool> *ptrDestroy =
-           new DESTRUCTOR_OF<LocalTraceBufferPool> (*_singleton);
+         DESTRUCTOR_OF<LocalTraceBufferPool> *ptrDestroy =
+           new DESTRUCTOR_OF<LocalTraceBufferPool> (*_singleton);
 
          // --- start a trace Collector
 
index 93dd0ebc4e0a21c87125119ed58b6ee6bf42cd24..3b31be363af8391d2ecd77bc950d070e293a7a82 100644 (file)
@@ -141,34 +141,37 @@ void* SALOMETraceCollector::run(void *bid)
       while ((!_threadToClose) || myTraceBuffer->toCollect() )
        {
          int fullBuf = myTraceBuffer->retrieve(myTrace);
-         if (myTrace.traceType == ABORT_MESS)
+         if (!CORBA::is_nil(_orb))
            {
-             stringstream abortMessage("");
+             if (myTrace.traceType == ABORT_MESS)
+               {
+                 stringstream abortMessage("");
 #ifndef WNT
-             abortMessage << "INTERRUPTION from thread "
-                          << myTrace.threadId << " : " << myTrace.trace;
+                 abortMessage << "INTERRUPTION from thread "
+                              << myTrace.threadId << " : " << myTrace.trace;
 #else
-             abortMessage << "INTERRUPTION from thread "
-                          << (void*)&myTrace.threadId 
-                          << " : " << myTrace.trace;
+                 abortMessage << "INTERRUPTION from thread "
+                              << (void*)&myTrace.threadId 
+                              << " : " << myTrace.trace;
 #endif
-             CORBA::String_var LogMsg =
-               CORBA::string_dup(abortMessage.str().c_str());
-             m_pInterfaceLogger->putMessage(LogMsg);
-             exit(1);
-           }
-         else
-           {
-             stringstream aMessage("");
+                 CORBA::String_var LogMsg =
+                   CORBA::string_dup(abortMessage.str().c_str());
+                 m_pInterfaceLogger->putMessage(LogMsg);
+                 exit(1);
+               }
+             else
+               {
+                 stringstream aMessage("");
 #ifndef WNT
-             aMessage << "th. " << myTrace.threadId
+                 aMessage << "th. " << myTrace.threadId
 #else
-             aMessage << "th. " << (void*)&myTrace.threadId
+                   aMessage << "th. " << (void*)&myTrace.threadId
 #endif
-                      << " " << myTrace.trace;
-             CORBA::String_var LogMsg =
-               CORBA::string_dup(aMessage.str().c_str());
-             m_pInterfaceLogger->putMessage(LogMsg);
+                          << " " << myTrace.trace;
+                 CORBA::String_var LogMsg =
+                   CORBA::string_dup(aMessage.str().c_str());
+                 m_pInterfaceLogger->putMessage(LogMsg);
+               }
            }
        }
     }