Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Follow coding style with _ prefix for fields
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Dec 29, 2016
1 parent a145847 commit b717442
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,36 +282,36 @@ private class CollectibleChecker
private const int MaxGCRetry = 10;
private const int MaxWaitTimePerGCRetryInMilli = 10;

private readonly int expectedCount;
private readonly ManualResetEvent evt;
private int unloadCount;
private readonly int _expectedCount;
private readonly ManualResetEvent _evt;
private int _unloadCount;

public CollectibleChecker(int expectedCount)
{
this.expectedCount = expectedCount;
evt = new ManualResetEvent(false);
_expectedCount = expectedCount;
_evt = new ManualResetEvent(false);
}

public void NotifyUnload()
{
if (expectedCount == Interlocked.Increment(ref unloadCount))
if (_expectedCount == Interlocked.Increment(ref _unloadCount))
{
evt.Set();
_evt.Set();
}
}

public void GcAndCheck(int overrideExpect = -1, int gcCount = MaxGCRetry)
{
CollectAndWait(gcCount);
Assert.Equal(overrideExpect >= 0 ? overrideExpect : expectedCount, unloadCount);
Assert.Equal(overrideExpect >= 0 ? overrideExpect : _expectedCount, _unloadCount);
}

private void CollectAndWait(int gcCount)
{
for (int i = 0; i < gcCount; i++)
{
GC.Collect(2, GCCollectionMode.Forced, true);
if (evt.WaitOne(MaxWaitTimePerGCRetryInMilli))
if (_evt.WaitOne(MaxWaitTimePerGCRetryInMilli))
{
break;
}
Expand Down

0 comments on commit b717442

Please sign in to comment.