using namespace std;
+//#define _DEVDEBUG_
#include "FileTraceCollector.hxx"
// Class attributes initialisation, for class method FileTraceCollector::run
void* FileTraceCollector::run(void *bid)
{
+ //DEVTRACE("init run");
_threadId = new pthread_t;
*_threadId = pthread_self();
sem_post(&_sem); // unlock instance
ofstream traceFile;
const char *theFileName = _fileName.c_str();
+ DEVTRACE("try to open trace file "<< theFileName);
traceFile.open(theFileName, ios::out | ios::app);
if (!traceFile)
{
// --- Loop until there is no more buffer to print,
// and no ask for end from destructor.
-
+ DEVTRACE("Begin loop");
while ((!_threadToClose) || myTraceBuffer->toCollect() )
{
if (_threadToClose)
_threadToClose = 0;
}
_singleton = 0;
- ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
// ============================================================================
#else
#endif
+//#define _DEVDEBUG_
#include "LocalTraceBufferPool.hxx"
#include "BaseTraceCollector.hxx"
#include "LocalTraceCollector.hxx"
ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
- LocalTraceBufferPool* myInstance = new LocalTraceBufferPool();
+ DEVTRACE("New buffer pool");
+ LocalTraceBufferPool* myInstance = new LocalTraceBufferPool();
DESTRUCTOR_OF<LocalTraceBufferPool> *ptrDestroy =
new DESTRUCTOR_OF<LocalTraceBufferPool> (*myInstance);
+ _singleton = myInstance;
// --- start a trace Collector
exit(1); // in case assert is deactivated
}
}
- _singleton = myInstance;
+ DEVTRACE("New buffer pool: end");
}
ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
ret=pthread_mutex_destroy(&_incrementMutex);
DEVTRACE("LocalTraceBufferPool::~LocalTraceBufferPool()-end");
_singleton = 0;
- ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
}
// ============================================================================