Commit e0039b10 authored by David COME's avatar David COME
Browse files

Changed DiskWriteTask main loop and method to release all the block

parent 2a26aaa3
......@@ -86,9 +86,8 @@ public:
tape::diskFile::WriteFile ourFile(m_recallingFile->path());
int blockId = 0;
MemBlock *mb = m_fifo.pop();
while(NULL!=mb){
while(1) {
if(MemBlock* const mb = m_fifo.pop()) {
AutoReleaseBlock releaser(mb,m_memManager);
if(m_recallingFile->fileid() != static_cast<unsigned int>(mb->m_fileid)
......@@ -105,10 +104,11 @@ public:
throw castor::tape::Exception("received a bad block for writing");
}
mb->m_payload.write(ourFile);
mb = m_fifo.pop();
blockId++;
}
ourFile.close();
else
break;
} //end of while(1)
reporter.reportCompletedJob(*m_recallingFile);
return true;
}
......@@ -151,16 +151,13 @@ public:
private:
void releaseAllBlock(){
try
{
while(1){
MemBlock* mb=m_fifo.tryPop();
if(mb) {
AutoReleaseBlock(mb,m_memManager);
}
}
MemBlock* mb=m_fifo.pop();
if(mb)
AutoReleaseBlock release(mb,m_memManager);
else
break;
}
catch(const castor::tape::threading::noMore&){}
}
/**
* The fifo containing the memory blocks holding data to be written to disk
......
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