Commit 839d5168 authored by David COME's avatar David COME
Browse files

Changed DiskReadTaskInterface:;execute's interface

DiskReadThreadPool::WorkerThread::run has been changed consequently
parent 6768761d
......@@ -27,14 +27,17 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
namespace castor {
namespace log{
class LogContext;
}
namespace tape {
namespace tapeserver {
namespace daemon {
class DiskReadTaskInterface {
public:
virtual void execute() =0;
virtual ~DiskReadTaskInterface() {}
};
class DiskReadTaskInterface {
public:
virtual void execute(log::LogContext& lc) =0;
virtual ~DiskReadTaskInterface() {}
};
}}}}
......@@ -37,7 +37,7 @@ namespace daemon {
class DiskReadThreadPool : public DiskThreadPoolInterface<DiskReadTaskInterface> {
public:
DiskReadThreadPool(int nbThread){
DiskReadThreadPool(int nbThread,castor::log::LogContext lc) : m_lc(lc){
for(int i=0; i<nbThread; i++) {
DiskReadWorkerThread * thr = new DiskReadWorkerThread(*this);
m_threads.push_back(thr);
......@@ -72,23 +72,25 @@ public:
private:
class DiskReadWorkerThread: private castor::tape::threading::Thread {
public:
DiskReadWorkerThread(DiskReadThreadPool & manager): m_manager(manager) {}
DiskReadWorkerThread(DiskReadThreadPool & manager): _this(manager) {}
void startThreads() { start(); }
void waitThreads() { wait(); }
private:
DiskReadThreadPool & m_manager;
DiskReadThreadPool & _this;
virtual void run() {
castor::log::LogContext lc = _this.m_lc;
std::auto_ptr<DiskReadTaskInterface> task;
while(1) {
task.reset( m_manager.m_tasks.pop());
task.reset( _this.m_tasks.pop());
if (NULL!=task.get())
task->execute();
task->execute(lc);
else
break;
}
}
};
std::vector<DiskReadWorkerThread *> m_threads;
castor::log::LogContext m_lc;
};
}}}}
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