-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
/*!
* This class is for use without CORBA, inside or outside SALOME.
* SALOME uses SALOMETraceCollector, to allow trace collection via CORBA.
- * Type of trace (and corresponding class) is choosen in LocalTraceBufferPool.
+ * Type of trace (and corresponding class) is chosen in LocalTraceBufferPool.
*
* Guarantees a unique object instance of the class (singleton thread safe)
* a separate thread for loop to print traces is launched.
{
if (_singleton == 0) // no need of lock when singleton already exists
{
- int ret;
- ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
DEVTRACE("FileTraceCollector:: instance()");
_singleton = myInstance; // _singleton known only when init done
DEVTRACE("FileTraceCollector:: instance()-end");
}
- ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ 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
+ * Mutex guarantees initialisation 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.
*/
// ============================================================================
-void* FileTraceCollector::run(void *bid)
+void* FileTraceCollector::run(void* /*bid*/)
{
//DEVTRACE("init run");
_threadId = new pthread_t;
FileTraceCollector:: ~FileTraceCollector()
{
- int ret;
- ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
if (_singleton)
{
DEVTRACE("FileTraceCollector:: ~FileTraceCollector()");
if (_threadId)
{
int ret = pthread_join(*_threadId, NULL);
- if (ret) std::cerr << "error close FileTraceCollector : "<< ret << std::endl;
- else DEVTRACE("FileTraceCollector destruction OK");
+ if (ret) { std::cerr << "error close FileTraceCollector : "<< ret << std::endl; }
+ else { DEVTRACE("FileTraceCollector destruction OK"); }
delete _threadId;
_threadId = 0;
_threadToClose = 0;
}
_singleton = 0;
}
- ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ pthread_mutex_unlock(&_singletonMutex); // release lock
}
// ============================================================================