Skip to content

Commit

Permalink
Added tailing iterator WaitAsync to wait for iteration to proceed.
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Oct 4, 2019
1 parent b06d112 commit 944504b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cs/src/core/Index/FasterLog/FasterLogIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace FASTER.core
{
Expand Down Expand Up @@ -79,6 +80,22 @@ internal unsafe FasterLogScanIterator(FasterLog fasterLog, BlittableAllocator<Em

}

/// <summary>
/// Wait for iteration to be ready to continue
/// </summary>
/// <returns></returns>
public async void WaitAsync()
{
while (true)
{
var commitTask = fasterLog.CommitTask;
if (nextAddress >= fasterLog.CommittedUntilAddress)
await commitTask;
else
break;
}
}

/// <summary>
/// Get next record in iterator
/// </summary>
Expand Down

0 comments on commit 944504b

Please sign in to comment.