Skip to content

Commit

Permalink
Rename write queue member.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 626c6e3 commit b6f911b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions src/XrdFileCache/XrdFileCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ bool
Cache::HaveFreeWritingSlots()
{
const static size_t maxWriteWaits=100000;
if ( s_writeQ.size < maxWriteWaits) {
if ( m_writeQ.size < maxWriteWaits) {
return true;
}
else {
XrdCl::DefaultEnv::GetLog()->Info(XrdCl::AppMsg, "Cache::HaveFreeWritingSlots() negative", s_writeQ.size);
XrdCl::DefaultEnv::GetLog()->Info(XrdCl::AppMsg, "Cache::HaveFreeWritingSlots() negative", m_writeQ.size);
return false;
}
}
Expand All @@ -189,38 +189,38 @@ void
Cache::AddWriteTask(Block* b, bool fromRead)
{
XrdCl::DefaultEnv::GetLog()->Dump(XrdCl::AppMsg, "Cache::AddWriteTask() bOff=%ld", b->m_offset);
s_writeQ.condVar.Lock();
m_writeQ.condVar.Lock();
if (fromRead)
s_writeQ.queue.push_back(b);
m_writeQ.queue.push_back(b);
else
s_writeQ.queue.push_front(b); // AMT should this not be the opposite
s_writeQ.size++;
s_writeQ.condVar.Signal();
s_writeQ.condVar.UnLock();
m_writeQ.queue.push_front(b); // AMT should this not be the opposite
m_writeQ.size++;
m_writeQ.condVar.Signal();
m_writeQ.condVar.UnLock();
}

//______________________________________________________________________________
void Cache::RemoveWriteQEntriesFor(File *iFile)
{
s_writeQ.condVar.Lock();
std::list<Block*>::iterator i = s_writeQ.queue.begin();
while (i != s_writeQ.queue.end())
m_writeQ.condVar.Lock();
std::list<Block*>::iterator i = m_writeQ.queue.begin();
while (i != m_writeQ.queue.end())
{
if ((*i)->m_file == iFile)
{

XrdCl::DefaultEnv::GetLog()->Dump(XrdCl::AppMsg, "Cache::Remove entries for %p path %s", (void*)(*i), iFile->lPath());
std::list<Block*>::iterator j = i++;
iFile->BlockRemovedFromWriteQ(*j);
s_writeQ.queue.erase(j);
--s_writeQ.size;
m_writeQ.queue.erase(j);
--m_writeQ.size;
}
else
{
++i;
}
}
s_writeQ.condVar.UnLock();
m_writeQ.condVar.UnLock();
}

//______________________________________________________________________________
Expand All @@ -229,16 +229,16 @@ Cache::ProcessWriteTasks()
{
while (true)
{
s_writeQ.condVar.Lock();
while (s_writeQ.queue.empty())
m_writeQ.condVar.Lock();
while (m_writeQ.queue.empty())
{
s_writeQ.condVar.Wait();
m_writeQ.condVar.Wait();
}
Block* block = s_writeQ.queue.front(); // AMT should not be back ???
s_writeQ.queue.pop_front();
s_writeQ.size--;
Block* block = m_writeQ.queue.front(); // AMT should not be back ???
m_writeQ.queue.pop_front();
m_writeQ.size--;
XrdCl::DefaultEnv::GetLog()->Dump(XrdCl::AppMsg, "Cache::ProcessWriteTasks for %p path %s", (void*)(block), block->m_file->lPath());
s_writeQ.condVar.UnLock();
m_writeQ.condVar.UnLock();

block->m_file->WriteBlockToDisk(block);
}
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace XrdFileCache
std::list<Block*> queue; //!< container
};

WriteQ s_writeQ;
WriteQ m_writeQ;

// prefetching
typedef std::vector<File*> PrefetchList;
Expand Down

0 comments on commit b6f911b

Please sign in to comment.