Commit 0c4bf0e6 authored by David COME's avatar David COME
Browse files

Moved LogContext of DiskWriteThreadPool::WordkingThread to run to a class attribute

Thus, threads' begins and ends are logged with the threadID
parent 3cf199bf
......@@ -102,7 +102,7 @@ namespace daemon {
}
void DiskWriteThreadPool::DiskWriteWorkerThread::run() {
std::auto_ptr<DiskWriteTaskInterface> task;
castor::log::LogContext lc = _this.m_lc;
while(1) {
task.reset(_this. m_tasks.pop());
if (NULL!=task.get()) {
......@@ -111,7 +111,7 @@ namespace daemon {
}
} //end of task!=NULL
else {
log::LogContext::ScopedParam(lc, log::Param("threadID", threadID));
log::LogContext::ScopedParam param(lc, log::Param("threadID", threadID));
lc.log(LOG_INFO,"Disk write thread finishing");
break;
}
......
......@@ -68,8 +68,11 @@ private:
public:
DiskWriteWorkerThread(DiskWriteThreadPool & manager):
threadID(m_nbActiveThread++),_this(manager)
{}
{
log::LogContext::ScopedParam param(lc, log::Param("threadID", threadID));
lc.log(LOG_INFO,"DiskWrite Thread created");
}
void startThreads() { start(); }
void waitThreads() { wait(); }
private:
......@@ -78,7 +81,7 @@ private:
static tape::threading::AtomicCounter<int> failledWritting;
const int threadID;
DiskWriteThreadPool & _this;
castor::log::LogContext lc;
virtual void run();
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment