Skip to content

Commit ca429ec

Browse files
authored
Merge pull request #397 from ZjzMisaka/add-StatusPingPongChecker
refactor: remove hitCount parameter
2 parents f518117 + 980dcff commit ca429ec

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

PowerThreadPool/Core/Worker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace PowerThreadPool
1818
{
1919
internal class Worker : IDisposable
2020
{
21-
private StatusPingPongChecker _statusPingPongChecker = new StatusPingPongChecker(10);
21+
private StatusPingPongChecker _statusPingPongChecker = new StatusPingPongChecker();
2222

2323
internal InterlockedFlag<CanDispose> CanDispose { get; } = Constants.CanDispose.Allowed;
2424
internal InterlockedFlag<CanForceStop> CanForceStop { get; } = Constants.CanForceStop.Allowed;

PowerThreadPool/Helpers/StatusPingPongChecker.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ internal class StatusPingPongChecker
77
private int _pingPongThresholdDivisor = 20000;
88
private Stopwatch _timeSinceLastIdle = new Stopwatch();
99
private Stopwatch _spinWatch = new Stopwatch();
10-
private HitChecker _hitChecker;
10+
private HitChecker _hitChecker = new HitChecker(10);
1111
private long _statusPingPongThresholdTicks;
1212

1313
internal bool HasPingedPong { get; set; }
1414

1515
internal bool CanSpin => _spinWatch.ElapsedTicks < _statusPingPongThresholdTicks;
1616

17-
internal StatusPingPongChecker(int hitCount)
17+
internal StatusPingPongChecker()
1818
{
19-
_hitChecker = new HitChecker(hitCount);
20-
2119
_timeSinceLastIdle.Start();
2220
_statusPingPongThresholdTicks = Stopwatch.Frequency / _pingPongThresholdDivisor;
2321
}

0 commit comments

Comments
 (0)