os.environ["SALOME_trace"]="local"
if args['file']:
- os.environ["SALOME_trace"]=args['file'][0]
+ os.environ["SALOME_trace"]="file:"+args['file'][0]
if args['logger']:
os.environ["SALOME_trace"]="with_logger"
locdir=os.environ['PWD']
CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDE) $(OCC_INCLUDES) $(QT_MT_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeResourcesManager
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSalomeResourcesManager
LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS) $(MPI_LIBS)
-LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
+LDFLAGSFORBIN= $(LDFLAGS)
LIBSFORBIN= $(LIBS)
@CONCLUDE@
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
CORBA::ORB_var orb = init(0 , 0 ) ;
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
BEGIN_OF(argv[0]);
#endif
END_OF(argv[0]);
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0 ;
}
CORBA::Object_var obj;
CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
BEGIN_OF(argv[0]);
try{
MESSAGE("Caught unknown exception.");
}
END_OF(argv[0]);
- delete myThreadTrace;
+ // delete myThreadTrace;
}
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+=
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
-LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
+LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
{
// initialize the ORB
CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
CosNaming::NamingContext_var _rootContext, catalogContext;
INFOS("Caught CORBA::Exception.")
}
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0;
}
CPPFLAGS += $(PYTHON_INCLUDES) $(QT_MT_INCLUDES)
LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager
-LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector
+LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification
LIBS += $(PYTHON_LIBS)
@CONCLUDE@
char *xargv = "";
char **argv = &xargv;
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
if (!ns)
{
_NS = new SALOME_NamingService(orb);
{
// Initializing omniORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
// Obtain a reference to the root POA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
LIBS += $(PYTHON_LIBS) $(MPI_LIBS)
CXXFLAGS+=${MPI_INCLUDES}
CXX_DEPEND_FLAG+=${MPI_INCLUDES}
- LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
+ LDFLAGSFORBIN= $(LDFLAGS)
LIBSFORBIN= $(LIBS)
endif
// Initialise the ORB.
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
CORBA::ORB_var &orb = init( argc , argv ) ;
- SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF("[" << numproc << "] " << argv[0])
try {
delete myContainer;
END_OF("[" << numproc << "] " << argv[0]);
- delete myThreadTrace;
+ // delete myThreadTrace;
MPI_Finalize();
BIN_SERVER_IDL = SALOME_ModuleCatalog.idl SALOME_Exception.idl
CPPFLAGS+= $(QT_MT_INCLUDES)
-LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lSALOMELocalTrace -lSALOMETraceCollector -lOpUtil
-LDFLAGSFORBIN+= -lSalomeNS -lSALOMELocalTrace -lSALOMETraceCollector -lOpUtil
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lSALOMELocalTrace -lOpUtil
+LDFLAGSFORBIN+= -lSalomeNS -lSALOMELocalTrace -lOpUtil
@CONCLUDE@
{
// initialize the ORB
CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
CosNaming::NamingContext_var _rootContext, catalogContext;
INFOS("Caught CORBA::Exception.")
}
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0;
}
BIN_SRC =
BIN_SERVER_IDL = SALOME_Registry.idl
-LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace
LDFLAGSFORBIN= $(LDFLAGS)
{
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
CORBA::ORB_var &orb = init( argc , argv ) ;
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF( argv[0] )
INFOS_COMPILATION
SCRUTE(argc)
}
END_OF( argv[0] ) ;
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0 ;
}
CPPFLAGS+= $(QT_MT_INCLUDES) -I$(srcdir)/../Container
CXXFLAGS+=
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+=
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
-LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
+LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
{
// initialize the ORB
CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
CosNaming::NamingContext_var _rootContext, catalogContext;
INFOS("Caught CORBA::Exception.")
}
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0;
}
#
LDXMUFLAGS= -L/usr/X11R6/lib -lXmu
LDFLAGS+=$(LDXMUFLAGS)
-LDFLAGSFORBIN= $(LDFLAGS) -lTKLCAF -lTKMath -lRegistry -lSalomeNotification -lSALOMETraceCollector -lSalomeContainer -lSalomeResourcesManager
+LDFLAGSFORBIN= $(LDFLAGS) -lTKLCAF -lTKMath -lRegistry -lSalomeNotification -lSalomeContainer -lSalomeResourcesManager
@CONCLUDE@
--- /dev/null
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BaseTraceCollector.cxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+
+using namespace std;
+
+#include "BaseTraceCollector.hxx"
+#include "LocalTraceBufferPool.hxx"
+
+// Class attributes initialisation, for class method BaseTraceCollector::run
+
+BaseTraceCollector* BaseTraceCollector::_singleton = 0;
+pthread_mutex_t BaseTraceCollector::_singletonMutex;
+int BaseTraceCollector::_threadToClose = 0;
+pthread_t* BaseTraceCollector::_threadId = 0; // used to control single run
+
+// ============================================================================
+/*!
+ * Destructor: wait until printing thread ends (BaseTraceCollector::run)
+ */
+// ============================================================================
+
+BaseTraceCollector:: ~BaseTraceCollector()
+{
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ _threadToClose = 1;
+ cerr << "BaseTraceCollector:: ~BaseTraceCollector()" << endl << flush;
+ myTraceBuffer->insert(NORMAL_MESS,"end of trace"); //needed to wake up thread
+ if (_threadId)
+ {
+ int ret = pthread_join(*_threadId, NULL);
+ if (ret) cerr << "error close BaseTraceCollector : "<< ret << endl;
+ else cerr << "BaseTraceCollector destruction OK" << endl;
+ _threadId = 0;
+ }
+}
+
+// ============================================================================
+/*!
+ * Constructor: no need of LocalTraceBufferPool object initialization here,
+ * thread safe singleton used in LocalTraceBufferPool::instance()
+ */
+// ============================================================================
+
+BaseTraceCollector::BaseTraceCollector()
+{
+ _threadId=0;
+}
+
+
--- /dev/null
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BaseTraceCollector.hxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#ifndef _BASETRACECOLLECTOR_HXX_
+#define _BASETRACECOLLECTOR_HXX_
+
+#include <pthread.h>
+
+
+#if defined SALOMELOCALTRACE_EXPORTS
+#if defined WIN32
+#define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
+#else
+#define SALOMELOCALTRACE_EXPORT
+#endif
+#else
+#if defined WNT
+#define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
+#else
+#define SALOMELOCALTRACE_EXPORT
+#endif
+#endif
+
+//! See derived Classes in SALOMELocalTrace for usage without CORBA,
+//! see derived Classes in SALOMETraceCollector for usage with CORBA.
+
+class SALOMELOCALTRACE_EXPORT BaseTraceCollector
+{
+ public:
+ ~BaseTraceCollector();
+
+ protected:
+ BaseTraceCollector();
+
+ static int _threadToClose;
+ static BaseTraceCollector* _singleton;
+ static pthread_mutex_t _singletonMutex;
+ static pthread_t* _threadId;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : FileTraceCollector.cxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+
+using namespace std;
+
+#include "FileTraceCollector.hxx"
+
+// Class attributes initialisation, for class method FileTraceCollector::run
+
+std::string FileTraceCollector::_fileName = "";
+
+// ============================================================================
+/*!
+ * This class is for use without CORBA, outside SALOME.
+ * SALOME uses SALOMETraceCollector, to allow trace collection via CORBA.
+ *
+ * guarantees a unique object instance of the class (singleton thread safe)
+ * a separate thread for loop to print traces is launched.
+ * \param typeTrace 0=standard out, 1=file(/tmp/tracetest.log)
+ * If typeTrace=0, checks environment for "SALOME_trace". Test values in
+ * the following order:
+ * - "local" standard out
+ * - anything else is kept as a file name
+ */
+// ============================================================================
+
+BaseTraceCollector* FileTraceCollector::instance(const char *fileName)
+{
+ if (_singleton == 0) // no need of lock when singleton already exists
+ {
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton == 0) // another thread may have got
+ { // the lock after the first test
+ _singleton = new FileTraceCollector();
+
+ _fileName = fileName;
+ cout << " _fileName: " << _fileName << endl;
+
+ pthread_t traceThread;
+ int bid;
+ int re2 = pthread_create(&traceThread, NULL,
+ FileTraceCollector::run, (void *)bid);
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ }
+ return _singleton;
+}
+
+// ============================================================================
+/*!
+ * In a separate thread, loop to print traces.
+ * Mutex garantees intialisation on instance method is done and only one run
+ * allowed (double check ...)
+ * Loop until there is no more buffer to print,
+ * and no ask for end from destructor.
+ * Get a buffer. If type = ABORT then exit application with message.
+ */
+// ============================================================================
+
+void* FileTraceCollector::run(void *bid)
+{
+ int isOKtoRun = 0;
+ int ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+
+ if (! _threadId) // only one run
+ {
+ isOKtoRun = 1;
+ if(_threadId == 0)
+ {
+ _threadId = new pthread_t;
+ }
+ *_threadId = pthread_self();
+ }
+ else cout << "----- Comment est-ce possible de passer la ? -------" <<endl;
+
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+
+ if (isOKtoRun)
+ {
+// if (_threadId == 0)
+// {
+// _threadId = new pthread_t;
+// }
+ if (_threadId == 0)
+ {
+ cerr << "FileTraceCollector::run error!" << endl << flush;
+ exit(1);
+ }
+
+// *_threadId = pthread_self();
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ LocalTrace_TraceInfo myTrace;
+
+ // --- opens a file with append mode
+ // so, several processes can share the same file
+
+ ofstream traceFile;
+ const char *theFileName = _fileName.c_str();
+ traceFile.open(theFileName, ios::out | ios::app);
+ if (!traceFile)
+ {
+ cerr << "impossible to open trace file "<< theFileName << endl;
+ exit (1);
+ }
+
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
+
+ while ((!_threadToClose) || myTraceBuffer->toCollect() )
+ {
+ int fullBuf = myTraceBuffer->retrieve(myTrace);
+ if (myTrace.traceType == ABORT_MESS)
+ {
+#ifndef WNT
+ traceFile << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
+#else
+ traceFile << "INTERRUPTION from thread "
+ << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ traceFile.close();
+ cout << flush ;
+#ifndef WNT
+ cerr << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
+#else
+ cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ cerr << flush ;
+ exit(1);
+ }
+ else
+ {
+#ifndef WNT
+ traceFile << "th. " << myTrace.threadId
+ << " " << myTrace.trace;
+#else
+ traceFile << "th. " << (void*)(&myTrace.threadId)
+ << " " << myTrace.trace;
+#endif
+ }
+ }
+ traceFile.close();
+ }
+ pthread_exit(NULL);
+ return NULL;
+}
+
+// ============================================================================
+/*!
+ * Destructor: wait until printing thread ends (FileTraceCollector::run)
+ */
+// ============================================================================
+
+FileTraceCollector:: ~FileTraceCollector()
+{
+ cerr << "FileTraceCollector:: ~FileTraceCollector()" << endl << flush;
+}
+
+// ============================================================================
+/*!
+ * Constructor: no need of LocalTraceBufferPool object initialization here,
+ * thread safe singleton used in LocalTraceBufferPool::instance()
+ */
+// ============================================================================
+
+FileTraceCollector::FileTraceCollector()
+{
+ _threadId=0;
+}
+
+
--- /dev/null
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : FileTraceCollector.hxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#ifndef _FILETRACECOLLECTOR_HXX_
+#define _FILETRACECOLLECTOR_HXX_
+
+#include <string>
+#include "LocalTraceBufferPool.hxx"
+#include "BaseTraceCollector.hxx"
+
+//! See also other derived Classes in SALOMELocalTrace for usage without CORBA,
+//! see also derived Classes in SALOMETraceCollector for usage with CORBA.
+
+class SALOMELOCALTRACE_EXPORT FileTraceCollector : public BaseTraceCollector
+{
+ public:
+ static BaseTraceCollector* instance(const char *fileName);
+ static void *run(void *bid);
+ ~FileTraceCollector();
+
+ protected:
+ FileTraceCollector();
+
+ static std::string _fileName;
+};
+
+#endif
#include <iostream>
#include <limits.h>
+#include <cassert>
+
+#ifndef WNT
+#include <dlfcn.h>
+#else
+#endif
#include "LocalTraceBufferPool.hxx"
+#include "BaseTraceCollector.hxx"
+#include "LocalTraceCollector.hxx"
+#include "FileTraceCollector.hxx"
+//#include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
#include "utilities.h"
+//! specialisation template...
+
+// void DESTRUCTEUR_DE_<LocalTraceBufferPool>::operator()(void)
+// {
+// if(_PtrObjet)
+// {
+// std::cerr << "deleting _PtrObjet LocalTraceBufferPool" << std::endl;
+// LocalTraceBufferPool* aPtr =
+// static_cast<LocalTraceBufferPool*>(_PtrObjet);
+// delete aPtr;
+// }
+// _PtrObjet = NULL ;
+// }
+
using namespace std;
// In case of truncated message, end of trace contains "...\n\0"
+
#define TRUNCATED_MESSAGE "...\n"
#define MAXMESS_LENGTH MAX_TRACE_LENGTH-5
+// Class static attributes initialisation
+
LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0;
#ifndef WNT
pthread_mutex_t LocalTraceBufferPool::_singletonMutex;
#else
-pthread_mutex_t LocalTraceBufferPool::_singletonMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t LocalTraceBufferPool::_singletonMutex =
+ PTHREAD_MUTEX_INITIALIZER;
#endif
+BaseTraceCollector *LocalTraceBufferPool::_myThreadTrace = 0;
// ============================================================================
/*!
- * guarantees a unique object instance of the class (singleton thread safe)
+ * Guarantees a unique object instance of the class (singleton thread safe).
+ * When the LocalTraceBufferPool instance is created, the trace collector is
+ * also created (singleton). Type of trace collector to create depends on
+ * environment variable "SALOME_trace":
+ * - "local" implies standard err trace, LocalTraceCollector is launched.
+ * - "file" implies trace in /tmp/tracetest.log
+ * - "file:pathname" implies trace in file pathname
+ * - anything else like "other" : try to load dynamically a library named
+ * otherTraceCollector, and invoque C method instance() to start a singleton
+ * instance of the trace collector. Example: with_loggerTraceCollector, for
+ * CORBA Log.
*/
// ============================================================================
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
_singleton = new LocalTraceBufferPool();
+
+// DESTRUCTEUR_DE_<LocalTraceBufferPool> *ptrDestroy =
+// new DESTRUCTEUR_DE_<LocalTraceBufferPool> (*_singleton);
+
+ // --- start a trace Collector
+
+ char* traceKind = getenv("SALOME_trace");
+ assert(traceKind);
+ cout<<"SALOME_trace="<<traceKind<<endl;
+
+ if (strcmp(traceKind,"local")==0)
+ {
+ _myThreadTrace = LocalTraceCollector::instance();
+ }
+ else if (strncmp(traceKind,"file",strlen("file"))==0)
+ {
+ char *fileName;
+ if (strlen(traceKind) > strlen("file"))
+ fileName = &traceKind[strlen("file")+1];
+ else
+ fileName = "/tmp/tracetest.log";
+
+ _myThreadTrace = FileTraceCollector::instance(fileName);
+ }
+ else // --- try a dynamic library
+ {
+ void* handle;
+#ifndef WNT
+ string impl_name = string ("lib") + traceKind
+ + string("TraceCollector.so");
+ handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+#else
+ string impl_name = string ("lib") + traceKind + string(".dll");
+ handle = dlopen( impl_name.c_str() , 0 ) ;
+#endif
+ if ( handle )
+ {
+ typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void);
+ FACTORY_FUNCTION TraceCollectorFactory =
+ (FACTORY_FUNCTION) dlsym(handle, "SingletonInstance");
+ char *error ;
+ if ( (error = dlerror() ) != NULL)
+ {
+ cerr << "Can't resolve symbol: SingletonInstance" <<endl;
+ cerr << "dlerror: " << error << endl;
+ assert(error == NULL); // to give file and line
+ exit(1); // in case assert is deactivated
+ }
+ _myThreadTrace = (TraceCollectorFactory) ();
+ }
+ else
+ {
+ cerr << "library: " << impl_name << " not found !" << endl;
+ assert(handle); // to give file and line
+ exit(1); // in case assert is deactivated
+ }
+ }
}
ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
LocalTraceBufferPool::~LocalTraceBufferPool()
{
+ cerr << "LocalTraceBufferPool::~LocalTraceBufferPool()" << endl << flush;
+ delete (_myThreadTrace);
int ret;
ret=sem_destroy(&_freeBufferSemaphore);
ret=sem_destroy(&_fullBufferSemaphore);
ret=pthread_mutex_destroy(&_incrementMutex);
+ cerr << "LocalTraceBufferPool::~LocalTraceBufferPool()" << endl << flush;
}
// ============================================================================
#include <pthread.h>
#include <semaphore.h>
+#include "BaseTraceCollector.hxx"
#define ABORT_MESS 1 // for traceType field in struct LocalTrace_TraceInfo
#define NORMAL_MESS 0
-#if defined SALOMELOCALTRACE_EXPORTS
-#if defined WIN32
-#define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
-#else
-#define SALOMELOCALTRACE_EXPORT
-#endif
-#else
-#if defined WNT
-#define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
-#else
-#define SALOMELOCALTRACE_EXPORT
-#endif
-#endif
-
-
-
struct SALOMELOCALTRACE_EXPORT LocalTrace_TraceInfo
{
char trace[MAX_TRACE_LENGTH];
unsigned long _insertPos;
unsigned long _retrievePos;
pthread_t _threadId;
+ static BaseTraceCollector *_myThreadTrace;
};
#endif
#include "LocalTraceCollector.hxx"
-// Class attributes initialisation, for class method LocalTraceCollector::run
-
-LocalTraceCollector* LocalTraceCollector::_singleton = 0;
-pthread_mutex_t LocalTraceCollector::_singletonMutex;
-int LocalTraceCollector::_threadToClose = 0;
-pthread_t* LocalTraceCollector::_threadId = 0; // used to control single run
-int LocalTraceCollector::_toFile = 0;
-std::string LocalTraceCollector::_fileName = "";
-
// ============================================================================
/*!
* This class is for use without CORBA, outside SALOME.
*/
// ============================================================================
-LocalTraceCollector* LocalTraceCollector::instance(int typeTrace)
+BaseTraceCollector* LocalTraceCollector::instance()
{
if (_singleton == 0) // no need of lock when singleton already exists
{
{ // the lock after the first test
_singleton = new LocalTraceCollector();
- _fileName = "/tmp/tracetest.log";
- _toFile=0;
-
- if (typeTrace) // caller sets a value different from default=0
- _toFile = typeTrace;
- else // check environment
- {
- char* traceKind = getenv("SALOME_trace");
- //cout<<"SALOME_trace="<<traceKind<<endl;
- if (traceKind)
- {
- if (strcmp(traceKind,"local")==0) _toFile=0;
-
- else
- {
- _toFile=1;
- _fileName = traceKind;
- }
- }
- }
- //cout <<"_toFile: "<<_toFile<<" _fileName: "<<_fileName<<endl;
-
pthread_t traceThread;
int bid;
int re2 = pthread_create(&traceThread, NULL,
{
int isOKtoRun = 0;
int ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+
if (! _threadId) // only one run
{
isOKtoRun = 1;
*_threadId = pthread_self();
}
else cout << "----- Comment est-ce possible de passer la ? -------" <<endl;
+
ret = pthread_mutex_unlock(&_singletonMutex); // release lock
if (isOKtoRun)
{
- if(_threadId == 0) {
- _threadId = new pthread_t;
- }
+ if(_threadId == 0)
+ {
+ _threadId = new pthread_t;
+ }
*_threadId = pthread_self();
LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
LocalTrace_TraceInfo myTrace;
- // if trace in file requested, opens a file with append mode
- // so, several processes can share the same file
-
-
- ofstream traceFile;
-
- switch (_toFile)
- {
- case 1 : // --- trace to file
- {
- const char *fileName = _fileName.c_str();
- traceFile.open(fileName, ios::out | ios::app);
- if (!traceFile)
- {
- cerr << "impossible to open trace file "<< fileName << endl;
- exit (1);
- }
- }
- break;
-
- case 0 : ; // --- trace to standard output
- default : // --- on standard output, too
- break;
- }
-
- // Loop until there is no more buffer to print,
- // and no ask for end from destructor.
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
while ((!_threadToClose) || myTraceBuffer->toCollect() )
{
int fullBuf = myTraceBuffer->retrieve(myTrace);
if (myTrace.traceType == ABORT_MESS)
{
- switch (_toFile)
- {
- case 1 : // --- trace to file
+ cout << flush ;
#ifndef WNT
- traceFile << "INTERRUPTION from thread " << myTrace.threadId
- << " : " << myTrace.trace;
+ cerr << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
#else
- traceFile << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
- << " : " << myTrace.trace;
+ cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
#endif
- traceFile.close();
- // no break here !
- case 0 : // --- trace to standard output
- default : // --- on standard output, too
- cout << flush ;
-#ifndef WNT
- cerr << "INTERRUPTION from thread " << myTrace.threadId
- << " : " << myTrace.trace;
-#else
- cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
- << " : " << myTrace.trace;
-#endif
- cerr << flush ;
- exit(1);
- break;
- }
+ cerr << flush ;
+ exit(1);
}
else
{
- switch (_toFile)
- {
- case 1 : // --- trace to file
-#ifndef WNT
- traceFile << "th. " << myTrace.threadId
- << " " << myTrace.trace;
-#else
- traceFile << "th. " << (void*)(&myTrace.threadId)
- << " " << myTrace.trace;
-#endif
- break;
- case 0 : // --- trace to standard output
- default : // --- on standard output, too
+ cout << flush ;
#ifndef WNT
- cout << "th. " << myTrace.threadId << " " << myTrace.trace;
+ cerr << "th. " << myTrace.threadId << " " << myTrace.trace;
#else
- cout << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace;
+ cerr << "th. " << (void*)(&myTrace.threadId)
+ << " " << myTrace.trace;
#endif
- break;
- }
+ cerr << flush ;
}
}
-
- if (_toFile==1) traceFile.close();
}
pthread_exit(NULL);
return NULL;
LocalTraceCollector:: ~LocalTraceCollector()
{
- LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
- _threadToClose = 1;
- myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread
- if (_threadId)
- {
- int ret = pthread_join(*_threadId, NULL);
- if (ret) cout << "error close LocalTraceCollector : "<< ret << endl;
- else cout << "LocalTraceCollector destruction OK" << endl;
- }
- delete myTraceBuffer;
+ cerr << "LocalTraceCollector:: ~LocalTraceCollector()" << endl << flush;
}
// ============================================================================
#include <string>
#include "LocalTraceBufferPool.hxx"
+#include "BaseTraceCollector.hxx"
-//! See SALOMETraceCollector instead of LocalTraceCollector for SALOME usage
+//! See also other derived Classes in SALOMELocalTrace for usage without CORBA,
+//! see also derived Classes in SALOMETraceCollector for usage with CORBA.
-class SALOMELOCALTRACE_EXPORT LocalTraceCollector
+class SALOMELOCALTRACE_EXPORT LocalTraceCollector : public BaseTraceCollector
{
public:
- static LocalTraceCollector* instance(int typeTrace=0);
+ static BaseTraceCollector* instance();
static void *run(void *bid);
~LocalTraceCollector();
protected:
LocalTraceCollector();
-
- static int _threadToClose;
- static int _toFile;
- static LocalTraceCollector* _singleton;
- static pthread_mutex_t _singletonMutex;
- static pthread_t* _threadId;
- static std::string _fileName;
};
#endif
# header files
EXPORT_HEADERS= utilities.h \
LocalTraceBufferPool.hxx \
- LocalTraceCollector.hxx
+ BaseTraceCollector.hxx
EXPORT_PYSCRIPTS =
# Libraries targets
LIB = libSALOMELocalTrace.la
-LIB_SRC = LocalTraceCollector.cxx \
+LIB_SRC = BaseTraceCollector.cxx \
+ LocalTraceCollector.cxx \
+ FileTraceCollector.cxx \
LocalTraceBufferPool.cxx
LIBS= @LIBS@
# Libraries targets
-LIB = libSALOMETraceCollector.la
+LIB = libwith_loggerTraceCollector.la
LIB_SRC = SALOMETraceCollector.cxx \
TraceCollector_WaitForServerReadiness.cxx
LIB_CLIENT_IDL = Logger.idl
-LDFLAGS+=
+LDFLAGS+= -lSALOMELocalTrace
@CONCLUDE@
*/
// ============================================================================
-LocalTraceCollector* SALOMETraceCollector::instance(CORBA::ORB_ptr theOrb,
- int typeTrace)
+BaseTraceCollector* SALOMETraceCollector::instance()
{
if (_singleton == 0) // no need of lock when singleton already exists
{
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
_singleton = new SALOMETraceCollector();
-
- _fileName = "/tmp/tracetest.log";
- _toFile=0;
- _orb = theOrb;
- if (typeTrace) // caller sets a value different from default=0
- _toFile = typeTrace;
- else // check environment
- {
- char* traceKind = getenv("SALOME_trace");
- //cout<<"SALOME_trace="<<traceKind<<endl;
- if (traceKind)
- {
- if (strcmp(traceKind,"local")==0) _toFile=0;
- else if (strcmp(traceKind,"with_logger")==0) _toFile=2;
- else
- {
- _toFile=1;
- _fileName = traceKind;
- }
- }
- }
- //cout <<"_toFile: "<<_toFile<<" _fileName: "<<_fileName<<endl;
+ int argc=0;
+ char *_argv=0;
+ char ** argv = &_argv;
+ _orb = CORBA::ORB_init (argc, argv);
pthread_t traceThread;
int bid;
if (! _threadId) // only one run
{
isOKtoRun = 1;
- if(_threadId == 0) {
- _threadId = new pthread_t;
- }
+ if(_threadId == 0)
+ {
+ _threadId = new pthread_t;
+ }
*_threadId = pthread_self();
}
if (isOKtoRun)
{
- if(_threadId == 0) {
- _threadId = new pthread_t;
- }
+ if(_threadId == 0)
+ {
+ _threadId = new pthread_t;
+ }
*_threadId = pthread_self();
LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
LocalTrace_TraceInfo myTrace;
- // if trace in file requested, opens a file with append mode
- // so, several processes can share the same file
- // if CORBA collection requested, wait for Logger server readiness
-
- ofstream traceFile;
SALOME_Logger::Logger_var m_pInterfaceLogger;
CORBA::Object_var obj;
- switch (_toFile)
+ obj = TraceCollector_WaitForServerReadiness(_orb,"Logger");
+ if (!CORBA::is_nil(obj))
+ m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
+ if (CORBA::is_nil(m_pInterfaceLogger))
{
- case 1 : // --- trace to file
- {
- const char *fileName = _fileName.c_str();
- traceFile.open(fileName, ios::out | ios::app);
- if (!traceFile)
- {
- cerr << "impossible to open trace file "<< fileName << endl;
- exit (1);
- }
- }
- break;
- case 2 : // --- trace collection via CORBA
- obj = TraceCollector_WaitForServerReadiness(_orb,"Logger");
- if (!CORBA::is_nil(obj))
- m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
- if (CORBA::is_nil(m_pInterfaceLogger))
- {
- cerr << "Logger server not found ! Abort" << endl;
- cerr << flush ;
- exit(1);
- }
- else
- {
- CORBA::String_var LogMsg =
- CORBA::string_dup("\n---Init logger trace---\n");
- m_pInterfaceLogger->putMessage(LogMsg);
- //cout << " Logger server found" << endl;
- }
- break;
- case 0 : ; // --- trace to standard output
- default : // --- on standard output, too
- break;
+ cerr << "Logger server not found ! Abort" << endl;
+ cerr << flush ;
+ exit(1);
+ }
+ else
+ {
+ CORBA::String_var LogMsg =
+ CORBA::string_dup("\n---Init logger trace---\n");
+ m_pInterfaceLogger->putMessage(LogMsg);
+ cout << " Logger server found" << endl;
}
- // Loop until there is no more buffer to print,
- // and no ask for end from destructor.
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
while ((!_threadToClose) || myTraceBuffer->toCollect() )
{
int fullBuf = myTraceBuffer->retrieve(myTrace);
if (myTrace.traceType == ABORT_MESS)
{
- switch (_toFile)
- {
- case 2 : // --- trace collection via CORBA
- {
- stringstream abortMessage("");
-#ifndef WNT
- abortMessage << "INTERRUPTION from thread "
- << myTrace.threadId << " : " << myTrace.trace;
-#else
- 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);
- }
- break;
- case 1 : // --- trace to file
-#ifndef WNT
- traceFile << "INTERRUPTION from thread " << myTrace.threadId
-#else
- traceFile << "INTERRUPTION from thread " << (void*)&myTrace.threadId
-#endif
- << " : " << myTrace.trace;
- traceFile.close();
- // no break here !
- case 0 : // --- trace to standard output
- default : // --- on standard output, too
- cout << flush ;
+ stringstream abortMessage("");
#ifndef WNT
- cerr << "INTERRUPTION from thread " << myTrace.threadId
+ abortMessage << "INTERRUPTION from thread "
+ << myTrace.threadId << " : " << myTrace.trace;
#else
- cerr << "INTERRUPTION from thread " << (void*)&myTrace.threadId
+ abortMessage << "INTERRUPTION from thread "
+ << (void*)&myTrace.threadId
+ << " : " << myTrace.trace;
#endif
- << " : " << myTrace.trace;
- cerr << flush ;
- exit(1);
- break;
- }
+ CORBA::String_var LogMsg =
+ CORBA::string_dup(abortMessage.str().c_str());
+ m_pInterfaceLogger->putMessage(LogMsg);
+ exit(1);
}
else
{
- switch (_toFile)
- {
- case 2 : // --- trace collection via CORBA
- {
- stringstream aMessage("");
+ 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);
- }
- break;
- case 1 : // --- trace to file
-#ifndef WNT
- traceFile << "th. " << myTrace.threadId
-#else
- traceFile << "th. " << (void*)&myTrace.threadId
-#endif
- << " " << myTrace.trace;
- break;
- case 0 : // --- trace to standard output
- default : // --- on standard output, too
-#ifndef WNT
- cout << "th. " << myTrace.threadId << " " << myTrace.trace;
-#else
- cout << "th. " << &myTrace.threadId << " " << myTrace.trace;
-#endif
- break;
- }
+ << " " << myTrace.trace;
+ CORBA::String_var LogMsg =
+ CORBA::string_dup(aMessage.str().c_str());
+ m_pInterfaceLogger->putMessage(LogMsg);
}
}
-
- if (_toFile==1) traceFile.close();
}
pthread_exit(NULL);
return NULL;
SALOMETraceCollector:: ~SALOMETraceCollector()
{
- LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
- _threadToClose = 1;
- myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread
- if (_threadId)
- {
- int ret = pthread_join(*_threadId, NULL);
- if (ret) cout << "error close SALOMETraceCollector : "<< ret << endl;
- else cout << "SALOMETraceCollector destruction OK" << endl;
- }
- delete myTraceBuffer;
}
// ============================================================================
_threadId=0;
}
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+extern "C"
+{
+ BaseTraceCollector *SingletonInstance(void)
+ {
+ BaseTraceCollector *instance = SALOMETraceCollector::instance();
+ return instance;
+ }
+}
#include <string>
#include <CORBA.h>
-#include "LocalTraceCollector.hxx"
+#include "BaseTraceCollector.hxx"
#include "LocalTraceBufferPool.hxx"
//! See LocalTraceCollector instead of SALOMETraceCollector,
#endif
#endif
-class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector: LocalTraceCollector
+class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector:
+ public BaseTraceCollector
{
public:
- static LocalTraceCollector* instance(CORBA::ORB_ptr theOrb, int typeTrace=0);
+ static BaseTraceCollector* instance();
static void *run(void *bid);
~SALOMETraceCollector();
BIN_SRC =
LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSalomeResourcesManager
-LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeResourcesManager
+LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSalomeResourcesManager
@CONCLUDE@
// Initializing omniORB
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
CORBA::ORB_var &orb = init( argc , argv ) ;
- LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
INFOS("Caught unknown exception.")
}
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0;
}
// Initializing omniORB
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
CORBA::ORB_var &orb = init( argc , argv ) ;
- SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF(argv[0])
try{
}
END_OF(argv[0]);
- delete myThreadTrace;
+ // delete myThreadTrace;
return 0 ;
}
/*! \class ATEXIT_
*
- * M\89canisme pour faire ex\89cuter une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage
- * \80 la fin du traitement : creation d'un singleton statique de l'objet
+ * Mecanisme pour faire executer une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage
+ * a la fin du traitement : creation d'un singleton statique de l'objet
* tres specialise ATEXIT_.
*
- * La cr\89ation d'un objet de type ATEXIT_ entra\8ene l'inscription de la fonction
- * Nettoyage() par atexit(). Il suffit donc de cr\89er un singleton statique du type ATEXIT_
- * pour effectuer cet enregistrement une seule fois ind\89pendament de l'utilisateur.
+ * La creation d'un objet de type ATEXIT_ entraine l'inscription de la fonction
+ * Nettoyage() par atexit(). Il suffit donc de creer un singleton statique du type ATEXIT_
+ * pour effectuer cet enregistrement une seule fois independament de l'utilisateur.
*/
//CCRT
{
public :
/*!
- * Allocation dynamique de Destructeurs, une liste cha\8en\89e de DESTRUCTEUR_GENERIQUE_* et enregistrement
+ * Allocation dynamique de Destructeurs, une liste chainee de DESTRUCTEUR_GENERIQUE_* et enregistrement
* de la fonction Nettoyage() par atexit().
*
- * La liste cha\8en\89e Destructeurs est d\89truite dans la fonction Nettoyage.
+ * La liste chainee Destructeurs est detruite dans la fonction Nettoyage.
*/
//CCRT ATEXIT_( void )
ATEXIT_( bool Make_ATEXIT )
ASSERT (DESTRUCTEUR_GENERIQUE_::Destructeurs==0);
if(MYDEBUG) MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
DESTRUCTEUR_GENERIQUE_::Destructeurs =
- new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs allou\89 dynamiquement (cf. ci-dessous) ,
- // il est utilis\89 puis d\89truit par la fonction Nettoyage
- int cr = atexit( Nettoyage ); // ex\89cute Nettoyage lors de exit, apr\88s la destruction des donn\89es statiques !
+ new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeur alloue dynamiquement (cf. ci-dessous) ,
+ // il est utilise puis detruit par la fonction Nettoyage
+ int cr = atexit( Nettoyage ); // execute Nettoyage lors de exit, aprs la destruction des donnees statiques !
ASSERT(cr==0) ;
ATEXIT_Done = true ;
}
/*!
- * traitement effectu\89 :
- * -# ex\89cution de tous les objets de type DESTRUCTEUR_DE_ stock\89s dans la liste Destructeurs (ce qui d\89truit les
+ * traitement effectue :
+ * -# execution de tous les objets de type DESTRUCTEUR_DE_ stockes dans la liste Destructeurs (ce qui detruit les
* singletons correspondant) ;
- * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stock\89s dans la liste Destructeurs;
+ * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stockes dans la liste Destructeurs;
* -# destruction de la liste Destructeurs.
*/