Skip to content
Snippets Groups Projects
Commit 6730db50 authored by Tobias Pietzsch's avatar Tobias Pietzsch
Browse files

Keep track of frame counter in fetch queue

Maybe clearToPrefetch() should be rename to prepareNextFrame() or similar.
parent 7e934465
Branches
No related tags found
No related merge requests found
......@@ -76,6 +76,9 @@ public class BlockingFetchQueues< E >
/** Condition for waiting take()s */
private final Condition notEmpty;
/** incremented with every {@link #clearToPrefetch()} call */
private volatile long currentFrame = 0;
public BlockingFetchQueues( final int numPriorities )
{
this( numPriorities, 16384 );
......@@ -182,12 +185,15 @@ public class BlockingFetchQueues< E >
* be empty after this call returns. Removed elements are moved to the
* {@link #prefetch} deque.
*/
// TODO: rename? (because of currentFrame)
public void clearToPrefetch()
{
final ReentrantLock lock = this.lock;
lock.lock();
try
{
++currentFrame;
// System.out.println( "prefetch size before clear = " + prefetch.size() );
// make room in the prefetch deque
......@@ -251,4 +257,14 @@ public class BlockingFetchQueues< E >
lock.unlock();
}
}
public int getNumPriorities()
{
return maxPriority + 1;
}
public long getCurrentFrame()
{
return currentFrame;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment